From efb5bde84d7323fd3699e54cdd8a65080a37db5a Mon Sep 17 00:00:00 2001 From: pdontthink Date: Sat, 30 Dec 2006 21:41:42 +0000 Subject: [PATCH] Remove HTML from login src and add image template git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12023 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/template/general_util.php | 27 ++++++++++++++----- src/login.php | 25 ++++++++++------- templates/default/image.tpl | 42 +++++++++++++++++++++++++++++ templates/default/login.tpl | 2 +- 4 files changed, 79 insertions(+), 17 deletions(-) create mode 100644 templates/default/image.tpl diff --git a/functions/template/general_util.php b/functions/template/general_util.php index bcae35e9..512b9f1c 100644 --- a/functions/template/general_util.php +++ b/functions/template/general_util.php @@ -77,7 +77,7 @@ $xhtml_end=''; /** - * Checks for an image icon and returns a complete HTML img tag or a text + * Checks for an image icon and returns a complete image tag or a text * string with the text icon based on what is found and user prefs. * * @param string $icon_theme_path User's chosen icon set @@ -100,12 +100,25 @@ function getIcon($icon_theme_path, $icon_name, $text_icon, $alt_text='', $w=NULL // If we found an icon, build an img tag to display it. If we didn't // find an image, we will revert back to the text icon. if (!is_null($icon_path)) { - $icon = ''; + global $oTemplate; + $oTemplate->assign('src', $icon_path); + $oTemplate->assign('alt', $alt_text); + $oTemplate->assign('title', $alt_text); + $oTemplate->assign('width', $w); + $oTemplate->assign('height', $h); + + // blank other attributes because the template + // object might already contain values due to + // having been used to show another image before + // this one + // + $oTemplate->assign('onclick', ''); + $oTemplate->assign('align', ''); + $oTemplate->assign('border', ''); + $oTemplate->assign('hspace', ''); + $oTemplate->assign('vspace', ''); + + $icon = $oTemplate->fetch('image.tpl'); } else { $icon = $text_icon; } diff --git a/src/login.php b/src/login.php index 25d45e20..40b0ffb9 100644 --- a/src/login.php +++ b/src/login.php @@ -128,21 +128,28 @@ displayHtmlHeader( "$org_name - " . _("Login"), $header, FALSE ); /* If they don't have a logo, don't bother.. */ $logo_str = ''; if (isset($org_logo) && $org_logo) { - /* Display width and height like good little people */ - $width_and_height = ''; + + $oTemplate->assign('src', $org_logo); + $oTemplate->assign('alt', sprintf(_("%s Logo"), $org_name)); + $oTemplate->assign('class', 'sqm_loginImage'); if (isset($org_logo_width) && is_numeric($org_logo_width) && $org_logo_width>0) { - $width_and_height = "width=\"$org_logo_width\" "; + $oTemplate->assign('width', $worg_logo_width); + } else { + $oTemplate->assign('width', ''); } if (isset($org_logo_height) && is_numeric($org_logo_height) && $org_logo_height>0) { - $width_and_height .= "height=\"$org_logo_height\" "; + $oTemplate->assign('height', $worg_logo_height); + } else { + $oTemplate->assign('height', ''); } - - $logo_str = '
'."\n"; + $oTemplate->assign('onclick', ''); + $oTemplate->assign('align', ''); + $oTemplate->assign('border', ''); + $oTemplate->assign('hspace', ''); + $oTemplate->assign('vspace', ''); + $logo_str = $oTemplate->fetch('image.tpl'); } $sm_attribute_str = ''; diff --git a/templates/default/image.tpl b/templates/default/image.tpl new file mode 100644 index 00000000..d9d4fbaa --- /dev/null +++ b/templates/default/image.tpl @@ -0,0 +1,42 @@ + /> diff --git a/templates/default/login.tpl b/templates/default/login.tpl index 421b1d69..ff1718ad 100644 --- a/templates/default/login.tpl +++ b/templates/default/login.tpl @@ -33,7 +33,7 @@ extract($t); -- 2.25.1
- + '; ?>