| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 87 | 2 | 0 | 1.000 | statement_sequence[12] |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 87 | 691 | libraries/joomla/access/permission/accesslevel.php |
| 2 | 87 | 657 | libraries/joomla/access/permission/simplerule.php |
| ||||
// Map the action to the rule.
$db->setQuery(
'REPLACE INTO `#__access_action_rule_map` (`action_id`, `rule_id`) VALUES'
. ' ('
. (int) $this->_action_id
. ', '
. (int) $this->_rule_id
. ')');
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
// Delete existing usergroup maps to the rule.
$db->setQuery(
'DELETE FROM `#__usergroup_rule_map`'
. ' WHERE `rule_id` = '
. (int) $this->_rule_id);
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
// Map the usergroups to the rule if any exist.
if (!empty($this->_user_groups))
{
// Build the values clause for the insert query.
$values= array();
foreach ($this->_user_groups as $group)
{
$values[]= '('
. (int) $group
. ', '
. (int) $this->_rule_id
. ')';
}
// Perform the insert query.
$db->setQuery(
'INSERT INTO `#__usergroup_rule_map` (`group_id`, `rule_id`) VALUES '
. implode(', ', $values));
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
}
// Delete existing user maps to the rule.
$db->setQuery(
'DELETE FROM `#__user_rule_map`'
. ' WHERE `rule_id` = '
. (int) $this->_rule_id);
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
// Map the users to the rule if any exist.
if (!empty($this->_users))
{
// Build the values clause for the insert query.
$values= array();
foreach ($this->_users as $user)
{
$values[]= '('
. (int) $user
. ', '
. (int) $this->_rule_id
. ')';
}
// Perform the insert query.
$db->setQuery(
'INSERT INTO `#__user_rule_map` (`user_id`, `rule_id`) VALUES '
. implode(', ', $values));
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
}
return TRUE;
|
| ||||
// Map the action to the rule.
$db->setQuery(
'REPLACE INTO `#__access_action_rule_map` (`action_id`, `rule_id`) VALUES'
. ' ('
. (int) $this->_action_id
. ', '
. (int) $this->_rule_id
. ')');
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
// Delete existing usergroup maps to the rule.
$db->setQuery(
'DELETE FROM `#__usergroup_rule_map`'
. ' WHERE `rule_id` = '
. (int) $this->_rule_id);
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
// Map the usergroups to the rule if any exist.
if (!empty($this->_user_groups))
{
// Build the values clause for the insert query.
$values= array();
foreach ($this->_user_groups as $group)
{
$values[]= '('
. (int) $group
. ', '
. (int) $this->_rule_id
. ')';
}
// Perform the insert query.
$db->setQuery(
'INSERT INTO `#__usergroup_rule_map` (`group_id`, `rule_id`) VALUES '
. implode(', ', $values));
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
}
// Delete existing user maps to the rule.
$db->setQuery(
'DELETE FROM `#__user_rule_map`'
. ' WHERE `rule_id` = '
. (int) $this->_rule_id);
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
// Map the users to the rule if any exist.
if (!empty($this->_users))
{
// Build the values clause for the insert query.
$values= array();
foreach ($this->_users as $user)
{
$values[]= '('
. (int) $user
. ', '
. (int) $this->_rule_id
. ')';
}
// Perform the insert query.
$db->setQuery(
'INSERT INTO `#__user_rule_map` (`user_id`, `rule_id`) VALUES '
. implode(', ', $values));
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
}
return TRUE;
|
| |||
// Map the action to the rule.
$db->setQuery('REPLACE INTO `#__access_action_rule_map` (`action_id`, `rule_id`) VALUES'
. ' ('
. (int) $this->_action_id
. ', '
. (int) $this->_rule_id
. ')');
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
// Delete existing usergroup maps to the rule.
$db->setQuery('DELETE FROM `#__usergroup_rule_map`'
. ' WHERE `rule_id` = '
. (int) $this->_rule_id);
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
// Map the usergroups to the rule if any exist.
if (!empty($this->_user_groups)) {
// Build the values clause for the insert query.
$values=array();
foreach ($this->_user_groups as $group) {
$values[]='('
. (int) $group
. ', '
. (int) $this->_rule_id
. ')';
}
// Perform the insert query.
$db->setQuery('INSERT INTO `#__usergroup_rule_map` (`group_id`, `rule_id`) VALUES '
. implode(', ',$values));
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
}
// Delete existing user maps to the rule.
$db->setQuery('DELETE FROM `#__user_rule_map`'
. ' WHERE `rule_id` = '
. (int) $this->_rule_id);
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
// Map the users to the rule if any exist.
if (!empty($this->_users)) {
// Build the values clause for the insert query.
$values=array();
foreach ($this->_users as $user) {
$values[]='('
. (int) $user
. ', '
. (int) $this->_rule_id
. ')';
}
// Perform the insert query.
$db->setQuery('INSERT INTO `#__user_rule_map` (`user_id`, `rule_id`) VALUES '
. implode(', ',$values));
$db->query();
// Check for a database error.
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return FALSE;
}
}
return TRUE;
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| None | |||