[Joomla-commits] r22958 - in development/trunk: administrator/components/com_config/models administrator/components/com_config/models/forms administrator/includes includes installation libraries/joomla/document/html/renderer

48 views
Skip to first unread message

githu...@jcode001.directrouter.com

unread,
Mar 28, 2012, 8:36:39 PM3/28/12
to joomla-...@joomlacode.org
Author: github_bot
Date: 2012-03-28 19:36:39 -0500 (Wed, 28 Mar 2012)
New Revision: 22958

Modified:
development/trunk/administrator/components/com_config/models/application.php
development/trunk/administrator/components/com_config/models/forms/application.xml
development/trunk/administrator/includes/application.php
development/trunk/includes/application.php
development/trunk/installation/CHANGELOG
development/trunk/libraries/joomla/document/html/renderer/head.php
Log:
Merge branch 'master' of github.com:joomla/joomla-cms

Modified: development/trunk/administrator/components/com_config/models/application.php
===================================================================
--- development/trunk/administrator/components/com_config/models/application.php 2012-03-28 18:36:44 UTC (rev 22957)
+++ development/trunk/administrator/components/com_config/models/application.php 2012-03-29 00:36:39 UTC (rev 22958)
@@ -22,14 +22,17 @@
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
+ *
* @return mixed A JForm object on success, false on failure
+ *
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_config.application', 'application', array('control' => 'jform', 'load_data' => $loadData));
- if (empty($form)) {
+ if (empty($form))
+ {
return false;
}

@@ -44,6 +47,7 @@
* data will be merged into the original data, overwriting it.
*
* @return array An array containg all global config data.
+ *
* @since 1.6
*/
public function getData()
@@ -60,17 +64,18 @@
$data['filters'] = JArrayHelper::fromObject($params->get('filters'));

// If no filter data found, get from com_content (update of 1.6/1.7 site)
- if (empty($data['filters'])) {
+ if (empty($data['filters']))
+ {
$contentParams = JComponentHelper::getParams('com_content');
$data['filters'] = JArrayHelper::fromObject($contentParams->get('filters'));
}

// Check for data in the session.
- $app = JFactory::getApplication();
- $temp = $app->getUserState('com_config.config.global.data');
+ $temp = JFactory::getApplication()->getUserState('com_config.config.global.data');

// Merge in the session data.
- if (!empty($temp)) {
+ if (!empty($temp))
+ {
$data = array_merge($data, $temp);
}

@@ -81,7 +86,9 @@
* Method to save the configuration data.
*
* @param array An array containing all global config data.
+ *
* @return bool True on success, false on failure.
+ *
* @since 1.6
*/
public function save($data)
@@ -101,13 +108,13 @@
return false;
}

-
- $asset = JTable::getInstance('asset');
+ $asset = JTable::getInstance('asset');
if ($asset->loadByName('root.1'))
{
$asset->rules = (string) $rules;

- if (!$asset->check() || !$asset->store()) {
+ if (!$asset->check() || !$asset->store())
+ {
JError::raiseNotice('SOME_ERROR_CODE', $asset->getError());
}
}
@@ -133,7 +140,8 @@
if ($extension->load((int) $extension_id))
{
$extension->params = (string) $registry;
- if (!$extension->check() || !$extension->store()) {
+ if (!$extension->check() || !$extension->store())
+ {
JError::raiseNotice('SOME_ERROR_CODE', $extension->getError());
}
}
@@ -155,24 +163,10 @@
/*
* Perform miscellaneous options based on configuration settings/changes.
*/
- // Escape the sitename if present.
- if (isset($data['sitename'])) {
- $data['sitename'] = $data['sitename'];
- }
-
- // Escape the MetaDesc if present.
- if (isset($data['MetaDesc'])) {
- $data['MetaDesc'] = $data['MetaDesc'];
- }
-
- // Escape the MetaKeys if present.
- if (isset($data['MetaKeys'])) {
- $data['MetaKeys'] = $data['MetaKeys'];
- }
-
// Escape the offline message if present.
- if (isset($data['offline_message'])) {
- $data['offline_message'] = JFilterOutput::ampReplace($data['offline_message']);
+ if (isset($data['offline_message']))
+ {
+ $data['offline_message'] = JFilterOutput::ampReplace($data['offline_message']);
}

// Purge the database session table if we are changing to the database handler.
@@ -182,12 +176,14 @@
$table->purge(-1);
}

- if (empty($data['cache_handler'])) {
+ if (empty($data['cache_handler']))
+ {
$data['caching'] = 0;
}

// Clean the cache if disabled but previously enabled.
- if (!$data['caching'] && $prev['caching']) {
+ if (!$data['caching'] && $prev['caching'])
+ {
$cache = JFactory::getCache();
$cache->clean();
}
@@ -196,15 +192,6 @@
$config = new JRegistry('config');
$config->loadArray($data);

- /*
- * Write the configuration file.
- */
- jimport('joomla.filesystem.path');
- jimport('joomla.filesystem.file');
-
- // Set the configuration file path.
- $file = JPATH_CONFIGURATION . '/configuration.php';
-
// Overwrite the old FTP credentials with the new ones.
$temp = JFactory::getConfig();
$temp->set('ftp_enable', $data['ftp_enable']);
@@ -214,27 +201,8 @@
$temp->set('ftp_pass', $data['ftp_pass']);
$temp->set('ftp_root', $data['ftp_root']);

- // Get the new FTP credentials.
- $ftp = JClientHelper::getCredentials('ftp', true);
-
- // Attempt to make the file writeable if using FTP.
- if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) {
- JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'));
- }
-
- // Attempt to write the configuration file as a PHP class named JConfig.
- $configString = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));
- if (!JFile::write($file, $configString)) {
- $this->setError(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'));
- return false;
- }
-
- // Attempt to make the file unwriteable if using FTP.
- if ($data['ftp_enable'] == 0 && !$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) {
- JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'));
- }
-
- return true;
+ // Write the configuration file.
+ return $this->writeConfigFile($config);
}

/**
@@ -251,51 +219,53 @@
$prev = new JConfig();
$prev = JArrayHelper::fromObject($prev);

- // Clean the cache if disabled but previously enabled.
- if ($prev['caching']) {
- $cache = JFactory::getCache();
- $cache->clean();
- }
-
// Create the new configuration object, and unset the root_user property
$config = new JRegistry('config');
unset($prev['root_user']);
$config->loadArray($prev);

- /*
- * Write the configuration file.
- */
+ // Write the configuration file.
+ return $this->writeConfigFile($config);
+
+ return true;
+ }
+
+ /**
+ * Method to write the configuration to a file.
+ *
+ * @param JRegistry $config A JRegistry object containing all global config data.
+ *
+ * @return bool True on success, false on failure.
+ *
+ * @since 2.5.4
+ */
+ private function writeConfigFile(JRegistry $config)
+ {
jimport('joomla.filesystem.path');
jimport('joomla.filesystem.file');

// Set the configuration file path.
$file = JPATH_CONFIGURATION . '/configuration.php';

- // Overwrite the old FTP credentials with the new ones.
- $temp = JFactory::getConfig();
- $temp->set('ftp_enable', $prev['ftp_enable']);
- $temp->set('ftp_host', $prev['ftp_host']);
- $temp->set('ftp_port', $prev['ftp_port']);
- $temp->set('ftp_user', $prev['ftp_user']);
- $temp->set('ftp_pass', $prev['ftp_pass']);
- $temp->set('ftp_root', $prev['ftp_root']);
-
// Get the new FTP credentials.
$ftp = JClientHelper::getCredentials('ftp', true);

// Attempt to make the file writeable if using FTP.
- if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) {
+ if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644'))
+ {
JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'));
}

// Attempt to write the configuration file as a PHP class named JConfig.
- if (!JFile::write($file, $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false)))) {
+ if (!JFile::write($file, $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false))))
+ {
$this->setError(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'));
return false;
}

// Attempt to make the file unwriteable if using FTP.
- if ($prev['ftp_enable'] == 0 && !$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) {
+ if ($prev['ftp_enable'] == 0 && !$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444'))
+ {
JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'));
}

Modified: development/trunk/administrator/components/com_config/models/forms/application.xml
===================================================================
--- development/trunk/administrator/components/com_config/models/forms/application.xml 2012-03-28 18:36:44 UTC (rev 22957)
+++ development/trunk/administrator/components/com_config/models/forms/application.xml 2012-03-29 00:36:39 UTC (rev 22958)
@@ -723,14 +723,6 @@
<fieldset
name="system"
label="CONFIG_SYSTEM_SETTINGS_LABEL">
- <field
- name="secret"
- type="text"
- label="COM_CONFIG_FIELD_SECRET_LABEL"
- description="COM_CONFIG_FIELD_SECRET_DESC"
- required="true"
- readonly="true"
- filter="alnum" />

<field
name="log_path"

Modified: development/trunk/administrator/includes/application.php
===================================================================
--- development/trunk/administrator/includes/application.php 2012-03-28 18:36:44 UTC (rev 22957)
+++ development/trunk/administrator/includes/application.php 2012-03-29 00:36:39 UTC (rev 22958)
@@ -148,6 +148,7 @@

$document->setTitle($this->getCfg('sitename'). ' - ' .JText::_('JADMINISTRATION'));
$document->setDescription($this->getCfg('MetaDesc'));
+ $document->setGenerator('Joomla! - Open Source Content Management');

$contents = JComponentHelper::renderComponent($component);
$document->setBuffer($contents, 'component');

Modified: development/trunk/includes/application.php
===================================================================
--- development/trunk/includes/application.php 2012-03-28 18:36:44 UTC (rev 22957)
+++ development/trunk/includes/application.php 2012-03-29 00:36:39 UTC (rev 22958)
@@ -184,6 +184,17 @@

$document->setTitle($params->get('page_title'));
$document->setDescription($params->get('page_description'));
+
+ // Add version number or not based on global configuration
+ if ($this->getCfg('MetaVersion', 0))
+ {
+ $document->setGenerator('Joomla! - Open Source Content Management - Version ' . JVERSION);
+ }
+ else
+ {
+ $document->setGenerator('Joomla! - Open Source Content Management');
+ }
+
$contents = JComponentHelper::renderComponent($component);
$document->setBuffer($contents, 'component');

Modified: development/trunk/installation/CHANGELOG
===================================================================
--- development/trunk/installation/CHANGELOG 2012-03-28 18:36:44 UTC (rev 22957)
+++ development/trunk/installation/CHANGELOG 2012-03-29 00:36:39 UTC (rev 22958)
@@ -26,6 +26,10 @@
- -> Removed
! -> Note

+28-Mar-2012 Mark Dexter
+ # [#28303] Change 28026 so it doesn't modify platform files
+ # [#28252] Don't show the site secret and optimize ConfigModelApplication
+
28-Mar-2012 Christophe Demko
# [#28314] #28299 can cause performance issue if root category is loaded in non multilanguage mode
# [#27961] Template is not displayed in the Styles (backend)

Modified: development/trunk/libraries/joomla/document/html/renderer/head.php
===================================================================
--- development/trunk/libraries/joomla/document/html/renderer/head.php 2012-03-28 18:36:44 UTC (rev 22957)
+++ development/trunk/libraries/joomla/document/html/renderer/head.php 2012-03-29 00:36:39 UTC (rev 22958)
@@ -96,15 +96,7 @@
$generator = $document->getGenerator();
if ($generator)
{
- // Add version number or not based on global configuration
- if (JFactory::getConfig()->get('MetaVersion', 0))
- {
- $buffer .= $tab . '<meta name="generator" content="' . htmlspecialchars($generator) . ' - Version ' . JVERSION . '" />' . $lnEnd;
- }
- else
- {
- $buffer .= $tab . '<meta name="generator" content="' . htmlspecialchars($generator) . '" />' . $lnEnd;
- }
+ $buffer .= $tab . '<meta name="generator" content="' . htmlspecialchars($generator) . '" />' . $lnEnd;
}

$buffer .= $tab . '<title>' . htmlspecialchars($document->getTitle(), ENT_COMPAT, 'UTF-8') . '</title>' . $lnEnd;

_______________________________________________
Joomla-commits mailing list
Joomla-...@joomlacode.org
http://joomlacode.org/mailman/listinfo/joomla-commits

Reply all
Reply to author
Forward
0 new messages