Skip to content

Commit

Permalink
Merge pull request #6148 from delftswa2014/patch-3
Browse files Browse the repository at this point in the history
Fix for issue #6042. Fix error message when phpinfo() is called.
  • Loading branch information
Kubik-Rubik committed Feb 27, 2015
2 parents e1bd37f + e31ce38 commit 57c7cc7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
29 changes: 23 additions & 6 deletions administrator/components/com_admin/models/sysinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ public function &getInfo()
if (is_null($this->info))
{
$this->info = array();
$version = new JVersion;
$platform = new JPlatform;
$db = JFactory::getDbo();
$version = new JVersion;
$platform = new JPlatform;
$db = JFactory::getDbo();

if (isset($_SERVER['SERVER_SOFTWARE']))
{
Expand All @@ -154,6 +154,20 @@ public function &getInfo()
return $this->info;
}

/**
* Method to get if phpinfo method is enabled from php.ini
*
* @return boolean True if enabled
*
* @since 3.4.1
*/
public function phpinfoEnabled()
{
$disabled = explode(',', ini_get('disable_functions'));

return !in_array('phpinfo', $disabled);
}

/**
* Method to get the PHP info
*
Expand All @@ -163,7 +177,7 @@ public function &getInfo()
*/
public function &getPHPInfo()
{
if (is_null($this->php_info))
if (is_null($this->php_info) && $this->phpinfoEnabled())
{
ob_start();
date_default_timezone_set('UTC');
Expand All @@ -180,6 +194,10 @@ public function &getPHPInfo()
$output = str_replace('</div>', '', $output);
$this->php_info = $output;
}
else
{
$this->php_info = JText::_('COM_ADMIN_PHPINFO_DISABLED');
}

return $this->php_info;
}
Expand Down Expand Up @@ -327,8 +345,7 @@ public function &getEditor()
{
if (is_null($this->editor))
{
$config = JFactory::getConfig();
$this->editor = $config->get('editor');
$this->editor = JFactory::getConfig()->get('editor');
}

return $this->editor;
Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/en-GB.com_admin.ini
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ COM_ADMIN_PHP_BUILT_ON="PHP Built On"
COM_ADMIN_PHP_INFORMATION="PHP Information"
COM_ADMIN_PHP_SETTINGS="PHP Settings"
COM_ADMIN_PHP_VERSION="PHP Version"
COM_ADMIN_PHPINFO_DISABLED="The built in phpinfo() function has been disabled by your host."
COM_ADMIN_PLATFORM_VERSION="Joomla! Platform Version"
COM_ADMIN_REGISTER_GLOBALS="Register Globals"
COM_ADMIN_RELEVANT_PHP_SETTINGS="Relevant PHP Settings"
Expand Down

0 comments on commit 57c7cc7

Please sign in to comment.