[Security][Acl] CS fix for commit: 3c3a90b9e5

This commit is contained in:
Joseph Bielawski 2013-01-07 09:53:09 +01:00
parent 3c3a90b9e5
commit d570dbe545

View File

@ -259,46 +259,42 @@ SELECTCLAUSE;
SELECTCLAUSE;
$types = array();
for ($i=0,$c=count($batch); $i<$c; $i++) {
$count = count($batch);
for ($i = 0; $i < $count; $i++) {
if (!isset($types[$batch[$i]->getType()])) {
$types[$batch[$i]->getType()] = true;
if(count($batch) > 1) {
if ($count > 1) {
break;
}
}
}
if(count($types) === 1) {
$where = '(o.object_identifier IN (%s) AND c.class_type = %s)';
if (1 === count($types)) {
$ids = array();
for ($i=0,$c=count($batch); $i<$c; $i++) {
for ($i = 0; $i < $count; $i++) {
$ids[] = $this->connection->quote($batch[$i]->getIdentifier());
}
$sql .= sprintf(
$where,
'(o.object_identifier IN (%s) AND c.class_type = %s)',
implode(',', $ids),
$this->connection->quote($batch[0]->getType())
);
} else {
$where = '(o.object_identifier = %s AND c.class_type = %s)';
for ($i=0,$c=count($batch); $i<$c; $i++) {
for ($i = 0; $i < $count; $i++) {
$sql .= sprintf(
$where,
$this->connection->quote($batch[$i]->getIdentifier()),
$this->connection->quote($batch[$i]->getType())
);
if ($i+1 < $c) {
if ($i+1 < $count) {
$sql .= ' OR ';
}
}
}
$sql .= ')';
return $sql;