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

com_fields missing $input fix #13058

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 11 additions & 9 deletions administrator/components/com_fields/helpers/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function getFields($context, $item = null, $prepareValue = false,
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_fields/models', 'FieldsModel');

self::$fieldsCache = JModelLegacy::getInstance('Fields', 'FieldsModel', array(
'ignore_request' => true)
'ignore_request' => true)
);

self::$fieldsCache->setState('filter.published', 1);
Expand Down Expand Up @@ -106,7 +106,7 @@ public static function getFields($context, $item = null, $prepareValue = false,
if (self::$fieldCache === null)
{
self::$fieldCache = JModelLegacy::getInstance('Field', 'FieldsModel', array(
'ignore_request' => true)
'ignore_request' => true)
);
}

Expand Down Expand Up @@ -240,6 +240,8 @@ public static function prepareForm($context, JForm $form, $data)
// Extracting the component and section
$parts = self::extract($context);

$input = JFactory::getApplication()->input;

if (! $parts)
{
return true;
Expand Down Expand Up @@ -303,7 +305,7 @@ public static function prepareForm($context, JForm $form, $data)
*/
$form->setFieldAttribute('catid', 'onchange', "categoryHasChanged(this);");
JFactory::getDocument()->addScriptDeclaration(
"function categoryHasChanged(element){
"function categoryHasChanged(element){
var cat = jQuery(element);
if (cat.val() == '" . $assignedCatids . "')return;
jQuery('input[name=task]').val('field.storeform');
Expand Down Expand Up @@ -333,7 +335,7 @@ public static function prepareForm($context, JForm $form, $data)

// Organizing the fields according to their category
$fieldsPerCategory = array(
0 => array()
0 => array()
);

foreach ($fields as $field)
Expand Down Expand Up @@ -458,7 +460,7 @@ public static function prepareForm($context, JForm $form, $data)
'ignore_request' => true)
);

if ((!isset($data->id) || !$data->id) && JFactory::getApplication()->input->getCmd('controller') == 'config.display.modules'
if ((!isset($data->id) || !$data->id) && $input->getCmd('controller') == 'config.display.modules'
&& JFactory::getApplication()->isSite())
{
// Modules on front end editing don't have data and an id set
Expand Down Expand Up @@ -566,10 +568,10 @@ public static function getFieldsPluginId()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('folder') . ' = ' . $db->quote('system'))
->where($db->quoteName('element') . ' = ' . $db->quote('fields'));
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('folder') . ' = ' . $db->quote('system'))
->where($db->quoteName('element') . ' = ' . $db->quote('fields'));
$db->setQuery($query);

try
Expand Down