Skip to content

Commit

Permalink
Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
Thong Tran committed Jul 23, 2015
1 parent fe254dc commit d775cea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
19 changes: 12 additions & 7 deletions libraries/joomla/access/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -549,15 +549,20 @@ public static function getActionsFromData($data, $xpath = "/access/section[@name
// If there some elements, analyse them
if (!empty($elements))
{
foreach ($elements as $action)
foreach ($elements as $element)
{
// Add the action to the actions array
$actions[] = (object) array(
'name' => (string) $action['name'],
'title' => (string) $action['title'],
'description' => (string) $action['description'],
'default' => isset($action['default']) ? (int) $action['default'] : null
);
$action = new StdClass;
$action->name = (string) $element['name'];
$action->title = (string) $element['title'];
$action->description = (string) $element['description'];

if (isset($element['default']))
{
$action->default = (int) $element['default'];
}

$actions[] = $action;
}
}

Expand Down
6 changes: 3 additions & 3 deletions libraries/joomla/form/fields/rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ protected function getInput()
if ($assetRule === null)
{
// If asset Rule is not exist yet. Use default option in action if available
$html[] = '<option value=""' . ($action->default === null ? ' selected="selected"' : '') . '>'
$html[] = '<option value=""' . (!isset($action->default) ? ' selected="selected"' : '') . '>'
. JText::_(empty($group->parent_id) && empty($component) ? 'JLIB_RULES_NOT_SET' : 'JLIB_RULES_INHERITED') . '</option>';
$html[] = '<option value="1"' . (is_int($action->default) && ($action->default == 1) ? ' selected="selected"' : '') . '>'
$html[] = '<option value="1"' . (isset($action->default) && ($action->default == 1) ? ' selected="selected"' : '') . '>'
. JText::_('JLIB_RULES_ALLOWED') . '</option>';
$html[] = '<option value="0"' . (is_int($action->default) && ($action->default == 0) ? ' selected="selected"' : '') . '>'
$html[] = '<option value="0"' . (isset($action->default) && ($action->default == 0) ? ' selected="selected"' : '') . '>'
. JText::_('JLIB_RULES_DENIED') . '</option>';
}
else
Expand Down

0 comments on commit d775cea

Please sign in to comment.