less array_push

This commit is contained in:
Timothy Warren 2019-02-12 15:23:38 -05:00
parent d193bcc249
commit 0bb492776e
23 changed files with 84 additions and 84 deletions

View File

@ -43,10 +43,10 @@ if (get_request('meth','REQUEST') != 'ajax') {
{
if ($app['server']->isAttrBinary($attribute->getName()))
{
array_push($attr['binary'], $attribute);
$attr['binary'][] = $attribute;
} else
{
array_push($attr['avail'], $attribute);
$attr['avail'][] = $attribute;
}
}

View File

@ -58,7 +58,7 @@ foreach ($ldap['attrs']['must'] as $attr)
{
if (is_null($request['template']->getAttribute($attr)))
{
array_push($ldap['attrs']['need'], $attribute_factory->newAttribute($attr, array('values' => array()), $app['server']->getIndex()));
$ldap['attrs']['need'][] = $attribute_factory->newAttribute($attr, array('values' => array()), $app['server']->getIndex());
}
}

View File

@ -150,7 +150,7 @@ function r_copy_dn($serverSRC,$serverDST,$snapshottree,$dnSRC,$dnDST,$remove) {
return FALSE;
}
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',_('Copy successful'),_('DN'),$dnDST,_('has been created.')));
$copy_message[] = sprintf('%s %s: <b>%s</b> %s', _('Copy successful'), _('DN'), $dnDST, _('has been created.'));
$hadError = false;
foreach ($children as $child_dn) {
@ -169,7 +169,7 @@ function r_copy_dn($serverSRC,$serverDST,$snapshottree,$dnSRC,$dnDST,$remove) {
if ($delete_result)
{
array_push($copy_message, sprintf('%s %s: <b>%s</b> %s', _('Delete successful'), _('DN'), $dnDST, _('has been deleted.')));
$copy_message[] = sprintf('%s %s: <b>%s</b> %s', _('Delete successful'), _('DN'), $dnDST, _('has been deleted.'));
}
}
@ -178,15 +178,15 @@ function r_copy_dn($serverSRC,$serverDST,$snapshottree,$dnSRC,$dnDST,$remove) {
if ($copy_result)
{
array_push($copy_message, sprintf('%s %s: <b>%s</b> %s',
$copy_message[] = sprintf('%s %s: <b>%s</b> %s',
$remove ? _('Move successful') : _('Copy successful'),
_('DN'), $dnDST, _('has been created.')));
_('DN'), $dnDST, _('has been created.'));
}
else
{
array_push($copy_message, sprintf('%s %s: <b>%s</b> %s',
$copy_message[] = sprintf('%s %s: <b>%s</b> %s',
$remove ? _('Move NOT successful') : _('Copy NOT successful'),
_('DN'), $dnDST, _('has NOT been created.')));
_('DN'), $dnDST, _('has NOT been created.'));
}
}

View File

@ -43,7 +43,7 @@ foreach ($request['dn'] as $dn) {
# We search all children, not only the visible children in the tree
if (! in_array_ignore_case($dn,$request['children'])) {
$request['children'] = array_merge($request['children'],$app['server']->getContainerContents($dn,null,0,'(objectClass=*)',LDAP_DEREF_NEVER));
array_push($request['parent'],$dn);
$request['parent'][] = $dn;
}
}
@ -94,7 +94,7 @@ if (count($request['children'])) {
foreach ($request['search'] as $value)
{
array_push($request['delete'], $value['dn']);
$request['delete'][] = $value['dn'];
}
echo '<tr>';

View File

@ -30,7 +30,7 @@ foreach ($request['dn'] as $dn)
'type' => 'error'));
} else
{
array_push($request['parent'], $dn);
$request['parent'][] = $dn;
}
}

View File

@ -278,7 +278,7 @@ function getMustAttrs($oclasses) {
{
foreach ($soc->getMustAttrs() as $sma)
{
array_push($mustattrs, $sma->getName());
$mustattrs[] = $sma->getName();
}
}
}

View File

@ -177,7 +177,7 @@ class AJAXTree extends HTMLTree {
$this->addEntry($child);
}
array_push($children,$this->getEntry($child));
$children[] = $this->getEntry($child);
}
$first_child = $this->create_before_child($parent_entry,$code);
@ -373,7 +373,7 @@ class AJAXTree extends HTMLTree {
{
if ($value->isOpened())
{
array_push($result, $value->getDN());
$result[] = $value->getDN();
}
}

View File

@ -861,7 +861,7 @@ class Attribute {
# Store our Aliases
foreach ($sattr->getAliases() as $alias)
{
array_push($this->aliases, strtolower($alias));
$this->aliases[] = strtolower($alias);
}
if ($sattr->getIsSingleValue())

View File

@ -422,7 +422,7 @@ class HTMLTree extends Tree {
$bases = $server->getContainerTop($logged_in_dn);
if (is_array($bases) && count($bases))
{
array_push($logged_in_dn_array, $bases);
$logged_in_dn_array[] = $bases;
}
$rdn = $logged_in_dn;

View File

@ -229,7 +229,7 @@ class PageRender extends Visitor {
if (! $attribute2) {
if (($pv = get_request(strtolower($joinattr),'REQUEST')) && isset($pv[$attribute->getName()][$i])) {
array_push($values,$pv[$attribute->getName()][$i]);
$values[] = $pv[$attribute->getName()][$i];
if (! $pv[$attribute->getName()][$i])
{
@ -237,7 +237,7 @@ class PageRender extends Visitor {
}
} else {
array_push($values,'');
$values[] = '';
$blank++;
}
@ -245,7 +245,7 @@ class PageRender extends Visitor {
return;
} elseif (count($attribute2->getValues()) != 1) {
array_push($values,'');
$values[] = '';
$blank++;
system_message(array(
@ -256,7 +256,7 @@ class PageRender extends Visitor {
} else
{
array_push($values, $attribute2->getValue(0));
$values[] = $attribute2->getValue(0);
}
}

View File

@ -267,7 +267,7 @@ class Query extends xmlTemplate {
foreach ($this->attributes as $attribute)
{
array_push($result, $attribute->getName());
$result[] = $attribute->getName();
}
} else {
@ -295,7 +295,7 @@ class Query extends xmlTemplate {
foreach ($this->attributes as $attribute)
{
array_push($result, $attribute->getName());
$result[] = $attribute->getName();
}
} else {

View File

@ -120,7 +120,7 @@ class Template extends xmlTemplate {
# If we havent recorded this objectclass already, do so now.
if (is_object($soc) && ! in_array($soc->getName(), $objectclasses))
{
array_push($objectclasses, $soc->getName(FALSE));
$objectclasses[] = $soc->getName(FALSE);
} elseif ( ! is_object($soc) && ! $_SESSION[APPCONFIG]->getValue('appearance', 'hide_template_warning'))
{
system_message(array(
@ -138,7 +138,7 @@ class Template extends xmlTemplate {
# If we havent recorded this objectclass already, do so now.
if (is_object($soc) && ! in_array($soc->getName(), $objectclasses))
{
array_push($objectclasses, $soc->getName(FALSE));
$objectclasses[] = $soc->getName(FALSE);
}
}
}
@ -960,7 +960,7 @@ class Template extends xmlTemplate {
foreach ($this->attributes as $index => $attribute) {
if ($attribute->getLDAPtype() == strtolower($type))
{
array_push($result, $attribute->getName());
$result[] = $attribute->getName();
}
}
@ -1006,7 +1006,7 @@ class Template extends xmlTemplate {
{
if ($attribute->isRDN())
{
array_push($return, $attribute);
$return[] = $attribute;
}
}
@ -1213,7 +1213,7 @@ class Template extends xmlTemplate {
continue;
}
array_push($result,$attribute);
$result[] = $attribute;
}
return $result;
@ -1234,7 +1234,7 @@ class Template extends xmlTemplate {
{
if ($attribute->isVisible())
{
array_push($result, $attribute);
$result[] = $attribute;
}
}
@ -1256,7 +1256,7 @@ class Template extends xmlTemplate {
{
if ($attribute->isInternal())
{
array_push($result, $attribute);
$result[] = $attribute;
}
}
@ -1606,7 +1606,7 @@ class Template extends xmlTemplate {
if ($soc->getType() == 'structural' && (! $inherited))
{
array_push($this->structural_oclass, $oclass);
$this->structural_oclass[] = $oclass;
}
# Make sure our MUST attributes are marked as such for this template.
@ -1651,7 +1651,7 @@ class Template extends xmlTemplate {
if ( ! in_array($objectclassattr, $allattrs))
{
array_push($allattrs, $objectclassattr);
$allattrs[] = $objectclassattr;
}
}
}
@ -1676,13 +1676,13 @@ class Template extends xmlTemplate {
if ( ! in_array($objectclassattr, $allattrs))
{
array_push($allattrs, $objectclassattr);
$allattrs[] = $objectclassattr;
}
}
}
# Keep a list to objectclasses we have processed, so we dont get into a loop.
array_push($oclass_processed,$oclass);
$oclass_processed[] = $oclass;
$supoclasses = $soc->getSupClasses();
if (count($supoclasses) || count($superclasslist)) {
@ -1761,7 +1761,7 @@ class Template extends xmlTemplate {
# Ensure that our objectclasses has "top".
if (isset($return['objectclass']) && ! in_array('top',$return['objectclass']))
{
array_push($return['objectclass'], 'top');
$return['objectclass'][] = 'top';
}
if ($attrsOnly)
@ -1821,7 +1821,7 @@ class Template extends xmlTemplate {
{
if ( ! in_array($value->getName(), $attr_to_keep))
{
array_push($attr_to_keep, $value->getName());
$attr_to_keep[] = $value->getName();
}
}
@ -1829,7 +1829,7 @@ class Template extends xmlTemplate {
{
if ( ! in_array($value->getName(), $attr_to_keep))
{
array_push($attr_to_keep, $value->getName());
$attr_to_keep[] = $value->getName();
}
}
}
@ -1909,7 +1909,7 @@ class Template extends xmlTemplate {
{
if ($attribute->isForceDelete())
{
array_push($result, $attribute);
$result[] = $attribute;
}
}
@ -1934,7 +1934,7 @@ class Template extends xmlTemplate {
if (in_array_ignore_case('extensibleobject',$this->getObjectClasses())) {
foreach ($server->SchemaAttributes() as $sattr) {
$attribute = $attribute_factory->newAttribute($sattr->getName(),array('values'=>array()),$server->getIndex(),null);
array_push($attributes,$attribute);
$attributes[] = $attribute;
}
} else {
@ -1951,7 +1951,7 @@ class Template extends xmlTemplate {
if (is_null($this->getAttribute($attr)))
{
$attribute = $attribute_factory->newAttribute($attr, array('values' => array()), $server->getIndex(), NULL);
array_push($attributes, $attribute);
$attributes[] = $attribute;
}
}
}

View File

@ -1234,7 +1234,7 @@ class TemplateRender extends PageRender {
{
if (in_array($attribute->getName(), $modified))
{
array_push($modified_attrs, $attribute->getFriendlyName());
$modified_attrs[] = $attribute->getFriendlyName();
}
}
@ -2038,12 +2038,12 @@ class TemplateRender extends PageRender {
if ($attribute->isRequired())
{
array_push($attrs['required'], $attribute);
$attrs['required'][] = $attribute;
}
elseif (! $attribute->getValues())
{
array_push($attrs['optional'], $attribute);
$attrs['optional'][] = $attribute;
}
}

View File

@ -128,7 +128,7 @@ abstract class Tree {
{
if ($details->isBaseDN() AND (( ! $this->getServer()->getValue('server', 'hide_noaccess_base')) OR $details->isInLdap()))
{
array_push($return, $details);
$return[] = $details;
}
}

View File

@ -193,7 +193,7 @@ class TreeItem {
return;
}
array_push($this->children,$dn);
$this->children[] = $dn;
$this->childsort = true;
}

View File

@ -41,7 +41,7 @@ abstract class Visitor {
$call = "$method$fnct$class";
array_push($methods,$call);
$methods[] = $call;
while ($class && ! method_exists($this,$call)) {
if (defined('DEBUGTMP') && DEBUGTMP)
@ -50,7 +50,7 @@ abstract class Visitor {
$class = get_parent_class($class);
$call = "$method$fnct$class";
array_push($methods,$call);
$methods[] = $call;
}
if (defined('DEBUGTMP') && DEBUGTMP)

View File

@ -653,7 +653,7 @@ class Config {
{
if (isset($values['untested']) && $values['untested'])
{
array_push($result, sprintf('%s.%s', $option, $param));
$result[] = sprintf('%s.%s', $option, $param);
}
}
}

View File

@ -143,7 +143,7 @@ abstract class DS {
{
if (isset($values['untested']) && $values['untested'])
{
array_push($result, sprintf('%s.%s', $option, $param));
$result[] = sprintf('%s.%s', $option, $param);
}
}
}

View File

@ -1216,7 +1216,7 @@ class ldap extends DS {
if ($results) {
foreach ($results as $index => $entry) {
$child_dn = $entry['dn'];
array_push($return,$child_dn);
$return[] = $child_dn;
}
}
@ -2872,7 +2872,7 @@ class ldap extends DS {
foreach ($results as $result)
{
array_push($dn_array, $result['dn']);
$dn_array[] = $result['dn'];
}
$dn_array = array_unique($dn_array);

View File

@ -144,9 +144,9 @@ abstract class Export {
if (get_request('sys_attr')) {
if (! in_array('*',$query['attrs']))
{
array_push($query['attrs'], '*');
$query['attrs'][] = '*';
}
array_push($query['attrs'],'+');
$query['attrs'][] = '+';
}
if (! $base)
@ -273,14 +273,14 @@ class ExportCSV extends Export {
$entries = array();
foreach ($this->results as $base => $results) {
foreach ($results as $dndetails) {
array_push($entries,$dndetails);
$entries[] = $dndetails;
unset($dndetails['dn']);
foreach (array_keys($dndetails) as $key)
{
if ( ! in_array($key, $headers))
{
array_push($headers, $key);
$headers[] = $key;
}
}

View File

@ -47,7 +47,7 @@ $app['function_files'] = array(
if (file_exists(LIBDIR.'functions.custom.php'))
{
array_push($app['function_files'], LIBDIR . 'functions.custom.php');
$app['function_files'][] = LIBDIR . 'functions.custom.php';
}
/**
@ -617,15 +617,15 @@ function debug_log($msg,$level,$indent) {
foreach ($args as $key) {
if (is_array($key))
{
array_push($fargs, serialize($key));
$fargs[] = serialize($key);
}
elseif (is_object($key))
{
array_push($fargs, sprintf('OBJECT:%s', get_class($key)));
$fargs[] = sprintf('OBJECT:%s', get_class($key));
}
else
{
array_push($fargs, $key);
$fargs[] = $key;
}
}
@ -837,7 +837,7 @@ function system_message($msg,$redirect=null) {
}
}
array_push($_SESSION['sysmsg'],$msg);
$_SESSION['sysmsg'][] = $msg;
if ($redirect) {
if (preg_match('/\?/',$redirect))
@ -1803,7 +1803,7 @@ function get_next_number($base,$attr,$increment=false,$filter=false,$startmin=nu
$values = array_change_key_case($values);
foreach ($values[$attr] as $value)
{
array_push($autonum, $value);
$autonum[] = $value;
}
}

View File

@ -214,7 +214,7 @@ class ObjectClass extends SchemaItem {
case 'SUP':
if ($strings[$i+1] != '(') {
$i++;
array_push($this->sup_classes,preg_replace("/'/",'',$strings[$i]));
$this->sup_classes[] = preg_replace("/'/", '', $strings[$i]);
} else {
$i++;
@ -222,7 +222,7 @@ class ObjectClass extends SchemaItem {
$i++;
if ($strings[$i] != '$')
{
array_push($this->sup_classes, preg_replace("/'/", '', $strings[$i]));
$this->sup_classes[] = preg_replace("/'/", '', $strings[$i]);
}
} while (! preg_match('/\)+\)?/',$strings[$i+1]));
@ -275,12 +275,12 @@ class ObjectClass extends SchemaItem {
$attr = new ObjectClass_ObjectClassAttribute($string,$this->name);
if ($server->isForceMay($attr->getName())) {
array_push($this->force_may,$attr);
array_push($this->may_attrs,$attr);
$this->force_may[] = $attr;
$this->may_attrs[] = $attr;
} else
{
array_push($this->must_attrs, $attr);
$this->must_attrs[] = $attr;
}
}
@ -302,7 +302,7 @@ class ObjectClass extends SchemaItem {
foreach ($attrs as $string) {
$attr = new ObjectClass_ObjectClassAttribute($string,$this->name);
array_push($this->may_attrs,$attr);
$this->may_attrs[] = $attr;
}
if (DEBUG_ENABLED)
@ -362,12 +362,12 @@ class ObjectClass extends SchemaItem {
$string = preg_replace('/\)+$/', '', $string);
}
array_push($attrs,$string);
$attrs[] = $string;
} elseif (preg_match('/^\(.*\)$/',$string)) {
$string = preg_replace('/^\(/','',$string);
$string = preg_replace('/\)+$/','',$string);
array_push($attrs,$string);
$attrs[] = $string;
} else {
# Handle the opening cases first
@ -376,7 +376,7 @@ class ObjectClass extends SchemaItem {
} elseif (preg_match('/^\(./',$string)) {
$string = preg_replace('/^\(/','',$string);
array_push($attrs,$string);
$attrs[] = $string;
$i++;
}
@ -398,7 +398,7 @@ class ObjectClass extends SchemaItem {
$i++;
}
array_push($attrs,$string);
$attrs[] = $string;
}
}
@ -430,7 +430,7 @@ class ObjectClass extends SchemaItem {
$return = array();
foreach ($this->sup_classes as $object_class) {
array_push($return,$object_class);
$return[] = $object_class;
$oc = $server->getSchemaObjectClass($object_class);
@ -578,7 +578,7 @@ class ObjectClass extends SchemaItem {
foreach ($this->getMustAttrs($parents) as $attr)
{
array_push($attr_names, $attr->getName());
$attr_names[] = $attr->getName();
}
return $attr_names;
@ -609,7 +609,7 @@ class ObjectClass extends SchemaItem {
foreach ($this->getMayAttrs($parents) as $attr)
{
array_push($attr_names, $attr->getName());
$attr_names[] = $attr->getName();
}
return $attr_names;
@ -638,7 +638,7 @@ class ObjectClass extends SchemaItem {
}
}
array_push($this->children_objectclasses,$name);
$this->children_objectclasses[] = $name;
}
/**
@ -1386,7 +1386,7 @@ class AttributeType extends SchemaItem {
debug_log('Entered (%%)', 9, 0, __FILE__, __LINE__, __METHOD__, $fargs);
}
array_push($this->aliases,$alias);
$this->aliases[] = $alias;
}
/**
@ -1469,7 +1469,7 @@ class AttributeType extends SchemaItem {
}
}
array_push($this->used_in_object_classes,$name);
$this->used_in_object_classes[] = $name;
}
/**
@ -1507,7 +1507,7 @@ class AttributeType extends SchemaItem {
}
}
array_push($this->required_by_object_classes,$name);
$this->required_by_object_classes[] = $name;
}
/**
@ -1731,7 +1731,7 @@ class MatchingRule extends SchemaItem {
}
}
array_push($this->used_by_attrs,$attr);
$this->used_by_attrs[] = $attr;
return true;
}
@ -1826,7 +1826,7 @@ class MatchingRuleUse extends SchemaItem {
$new_attr = $strings[$i];
$new_attr = preg_replace("/^\'/",'',$new_attr);
$new_attr = preg_replace("/\'$/",'',$new_attr);
array_push($this->used_by_attrs,$new_attr);
$this->used_by_attrs[] = $new_attr;
$i++;
}
}

View File

@ -241,7 +241,7 @@ abstract class xmlTemplates {
{
if (is_null($type) || ( ! is_null($type) && $template->isType($type)))
{
array_push($result, $template);
$result[] = $template;
}
}
}
@ -290,7 +290,7 @@ abstract class xmlTemplates {
foreach ($this->templates as $template)
{
array_push($result, $template->getFileName());
$result[] = $template->getFileName();
}
return $result;
@ -549,7 +549,7 @@ abstract class xmlTemplate {
if (is_null($attrid))
{
array_push($this->attributes, $attribute);
$this->attributes[] = $attribute;
}
return $attribute;
@ -570,7 +570,7 @@ abstract class xmlTemplate {
foreach ($this->attributes as $attribute)
{
array_push($result, $attribute->getName());
$result[] = $attribute->getName();
}
return $result;