Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JHTML::image() can return a bad image link #300

Closed
alwarren opened this issue Aug 4, 2012 · 1 comment
Closed

JHTML::image() can return a bad image link #300

alwarren opened this issue Aug 4, 2012 · 1 comment

Comments

@alwarren
Copy link

alwarren commented Aug 4, 2012

When calling JJHTML::image() with $relative set to true, a bad image link is created in administrator when an image file exists only in JPATH_THEMES . "/$template/$folder/system/$file".

Discussion and test file at http://forum.joomla.org/viewtopic.php?f=579&t=734663

Cause:
See the statements at about line 417 of /libraries/joomla/hmtl/html.php

// Try to deal with system files in the template folder
elseif (file_exists(JPATH_THEMES . "/$template/$folder/system/$file"))
{
    $includes[] = JURI::root(true) . "/templates/$template/$folder/system/$file";
    break;
}

The file is detected in /$template/$folder/system/$file but the link builds as webroot/$template/$folder/system/$file. In administrator, the link should be built as webroot/administrator/$template/$folder/system/$file instead.

Solution:
Change

    $includes[] = JURI::root(true) . "/templates/$template/$folder/system/$file";

To:

    $includes[] = JURI::root(true) . ($app->isAdmin() ? '/administrator' : '') . "/templates/$template/$folder/system/$file";

To be honest, I don't know how this scenario would exist unless someone moved an image into /templates/$template/$folder/system. But, I thought I'd post this in case someone ran across it or the developers wanted to do a fix.

@elinw
Copy link
Contributor

elinw commented Aug 25, 2012

This is an issue in the platform. Would you make a pull request for the change and explain why you think it is necessary in the platform repository?

@mbabker mbabker closed this as completed Dec 28, 2012
wilsonge pushed a commit that referenced this issue Jan 23, 2017
* form validation fixes
dneukirchen pushed a commit to dneukirchen/joomla-cms that referenced this issue Sep 28, 2017
* moved to modern event system

* moved to modern event system

* moved to modern event system

* added ProviderManager
refactored

* ProviderInterface

* fixups

* fixups

* fixups

* fixups

* fixups

* fixups

* fixups

* fixups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants