Commit 2c3ee98e authored by Côme Chilliet's avatar Côme Chilliet

Merge branch '5820-use-the-new-features-from-php-5-6' into '1.4-dev'

Resolve "Use the new features from PHP 5.6"

See merge request fusiondirectory/fd-plugins!229
parents aeb77f9d e75cb3f6
......@@ -79,7 +79,7 @@ class ArgonautServiceNameAttribute extends CompositeAttribute
}
}
function loadAttrValue ($attrs)
function loadAttrValue (array $attrs)
{
if (isset($attrs[$this->getLdapName()])) {
for ($i = 0; $i < $attrs[$this->getLdapName()]['count']; $i++) {
......
......@@ -216,12 +216,12 @@ class DhcpSectionsAttribute extends DialogOrderedArrayAttribute
}
}
protected function loadAttrValue ($attrs)
protected function loadAttrValue (array $attrs)
{
}
/* Not saving anything into base node */
function fillLdapValue (&$attrs)
function fillLdapValue (array &$attrs)
{
/* Remove crap made by plugin */
unset ($attrs[$this->getLdapName()]);
......@@ -439,7 +439,7 @@ class DhcpSectionsAttribute extends DialogOrderedArrayAttribute
return $ids;
}
function foreignKeyUpdate($oldvalue, $newvalue, $source)
function foreignKeyUpdate($oldvalue, $newvalue, array $source)
{
if (($source['CLASS'] == 'serverGeneric') && ($source['FIELD'] == 'dn') && ($source['MODE'] == 'move')) {
$globalNode = $this->value[0][0];
......@@ -464,7 +464,7 @@ class DhcpSectionsAttribute extends DialogOrderedArrayAttribute
}
}
function foreignKeyCheck($value, $source)
function foreignKeyCheck($value, array $source)
{
if (($source['CLASS'] == 'serverGeneric') && ($source['FIELD'] == 'dn')) {
$globalNode = $this->value[0][0];
......
......@@ -58,7 +58,7 @@ class DhcpHostsAttribute extends OrderedArrayAttribute
$this->setInLdap(FALSE);
}
protected function loadAttrValue ($attrs)
protected function loadAttrValue (array $attrs)
{
}
......@@ -264,7 +264,7 @@ class DhcpHostsAttribute extends OrderedArrayAttribute
}
}
function fillLdapValue (&$attrs)
function fillLdapValue (array &$attrs)
{
if ($this->plugin->is_template) {
$attrs[$this->getLdapName()] = array_map(
......
......@@ -20,7 +20,7 @@
class LocRecordAttribute extends CompositeAttribute
{
function __construct ($description, $ldapName, $attributes, $acl = '', $label = NULL)
function __construct ($description, $ldapName, array $attributes, $acl = '', $label = NULL)
{
$readFormat = '/^(?P<lat>[[:digit:] \.]+ [NS])\s+'.
'(?P<long>[[:digit:] \.]+ [EW])\s+'.
......@@ -29,7 +29,7 @@ class LocRecordAttribute extends CompositeAttribute
parent::__construct ($description, $ldapName, $attributes, $readFormat, FALSE, $acl, $label);
}
function writeValues($values)
function writeValues(array $values)
{
/* '%s %s %.2fm[ %.2fm[ %.2fm[ %.2fm]]]' */
$str = sprintf('%s %s %.2fm', $values['lat'], $values['long'], $values['alt']);
......@@ -48,7 +48,7 @@ class LocRecordAttribute extends CompositeAttribute
class LocRecordLatLongAttribute extends CompositeAttribute
{
function __construct ($label, $description, $ldapName, $attributes, $acl = '')
function __construct ($label, $description, $ldapName, array $attributes, $acl = '')
{
$readFormat = '/^(?P<degrees>[[:digit:]]+)'.
'(\s+(?P<minutes>[[:digit:]]+)(\s+(?P<seconds>[[:digit:]\.]+))?)?'.
......@@ -58,7 +58,7 @@ class LocRecordLatLongAttribute extends CompositeAttribute
$this->setLinearRendering(TRUE);
}
function writeValues($values)
function writeValues(array $values)
{
/* The format is: d1 [m1 [s1]] {"N"|"S"|"E"|"W"} */
$str = $values['degrees'];
......@@ -453,7 +453,7 @@ class DnsRecordAttribute extends CompositeAttribute
return FALSE;
}
function setAttributes ($attributes)
function setAttributes (array $attributes)
{
parent::setAttributes($attributes);
$this->attributes[0]->setAcl($this->getHtmlId());
......
......@@ -257,7 +257,7 @@ class DnsRecordsAttribute extends DialogOrderedArrayAttribute
return $reverseZones;
}
protected function loadAttrValue ($attrs)
protected function loadAttrValue (array $attrs)
{
global $config;
......@@ -349,7 +349,7 @@ class DnsRecordsAttribute extends DialogOrderedArrayAttribute
sort($this->value);
}
function fillLdapValue (&$attrs)
function fillLdapValue (array &$attrs)
{
foreach (array_keys(DnsRecordAttribute::$types) as $type) {
if (!isset($attrs[$type])) {
......
......@@ -29,7 +29,7 @@ class DnsRecordsFilteredAttribute extends DnsRecordsAttribute
$this->zoneDn = $zoneDn;
}
protected function loadAttrValue ($attrs)
protected function loadAttrValue (array $attrs)
{
}
......@@ -90,7 +90,7 @@ class DnsRecordsFilteredAttribute extends DnsRecordsAttribute
}
}
function fillLdapValue (&$attrs)
function fillLdapValue (array &$attrs)
{
if ($this->plugin->is_template) {
$attrs[$this->getLdapName()] = array_map(
......
......@@ -85,12 +85,12 @@ class DiskPartitionsAttribute extends DialogOrderedArrayAttribute
parent::__construct ($label, $description, $ldapName, FALSE, $values, $acl);
}
protected function loadAttrValue ($attrs)
protected function loadAttrValue (array $attrs)
{
}
/* Not saving anything into base node */
function fillLdapValue (&$attrs)
function fillLdapValue (array &$attrs)
{
}
......
......@@ -132,11 +132,11 @@ class FaiPartitionSizeAttribute extends CompositeAttribute
if ($this->attributes[0]->getValue() == 'dynamic') {
$mp = array(
'%' => 1,
'KB' => pow(1024, 0),
'MB' => pow(1024, 1),
'GB' => pow(1024, 2),
'TB' => pow(1024, 3),
'PB' => pow(1024, 4)
'KB' => 1024 ** 0,
'MB' => 1024 ** 1,
'GB' => 1024 ** 2,
'TB' => 1024 ** 3,
'PB' => 1024 ** 4
);
$res1 = $this->attributes[1]->getValue() * $mp[$this->attributes[2]->getValue()];
$res2 = $this->attributes[3]->getValue() * $mp[$this->attributes[4]->getValue()];
......@@ -164,7 +164,7 @@ class FaiPartitionSizeAttribute extends CompositeAttribute
$this->updateAttributes();
}
function writeValues($values)
function writeValues(array $values)
{
if ($values[0] == 'remaining') {
return '0-';
......
......@@ -132,7 +132,7 @@ class PartitionTableAttribute extends DialogOrderedArrayAttribute
}
}
protected function loadAttrValue ($attrs)
protected function loadAttrValue (array $attrs)
{
global $config;
if (isset($attrs['dn'])) {
......@@ -195,7 +195,7 @@ class PartitionTableAttribute extends DialogOrderedArrayAttribute
}
/* Not saving anything into base node */
function fillLdapValue (&$attrs)
function fillLdapValue (array &$attrs)
{
}
......
......@@ -40,7 +40,7 @@ class FAITemplateFilesAttribute extends DialogOrderedArrayAttribute
parent::__construct ($label, $description, $ldapName, FALSE, $values, $acl);
}
protected function loadAttrValue ($attrs)
protected function loadAttrValue (array $attrs)
{
global $config;
if (isset($attrs['dn'])) {
......@@ -64,7 +64,7 @@ class FAITemplateFilesAttribute extends DialogOrderedArrayAttribute
}
/* Not saving anything into base node */
function fillLdapValue (&$attrs)
function fillLdapValue (array &$attrs)
{
}
......
......@@ -110,7 +110,7 @@ class AccessRightsAttribute extends CompositeAttribute
return $values;
}
function writeValues($values)
function writeValues(array $values)
{
$tmode = '';
foreach (array('s', 'u', 'g', 'o') as $type) {
......
......@@ -47,7 +47,7 @@ class MailQuotaAttribute extends IntAttribute
}
}
function renderAttribute(&$attributes, $readOnly)
function renderAttribute(array &$attributes, $readOnly)
{
parent::renderAttribute($attributes, $readOnly);
$attributes[$this->getLdapName().'_usage'] = array(
......
......@@ -61,7 +61,7 @@ class ProductPropertyAttribute extends CompositeAttribute
trigger_error('Should never be called');
}
function writeValues($values)
function writeValues(array $values)
{
trigger_error('Should never be called');
}
......
......@@ -51,7 +51,7 @@ class EpochDaysDateAttribute extends DateAttribute
}
}
protected function dateToLdap($dateValue)
protected function dateToLdap(DateTime $dateValue)
{
return floor($dateValue->format('U') / static::$secondsPerDay);
}
......@@ -957,7 +957,7 @@ class posixAccount extends simplePlugin
if (isset($tmp[1])) {
$hwm = $tmp[1];
} else {
$hwm = pow(2, 32);
$hwm = (2 ** 32);
}
/* Find out next free id near to UID_BASE */
for ($id = $base; $id++; $id < $hwm) {
......
......@@ -36,7 +36,7 @@ class QuotaEntryAttribute extends CharSeparatedCompositeAttribute
return $values;
}
function writeValues($values)
function writeValues(array $values)
{
if (!empty($values[5])) {
$blocksize = $this->plugin->getBlockSize($values[5], $values[0]);
......
......@@ -35,7 +35,7 @@ class MungedAttribute extends Attribute
$this->flagList = $flagList;
}
protected function loadAttrValue ($attrs)
protected function loadAttrValue (array $attrs)
{
if (isset($attrs[$this->getLdapName()])) {
$this->setValue($this->inputValue($attrs[$this->getLdapName()][0]));
......
......@@ -29,7 +29,7 @@ class workingTime extends CompositeAttribute
/*!
* \brief Write working time values
*/
function writeValues($values)
function writeValues(array $values)
{
return $values[0] * 60 + $values[1];
}
......
......@@ -39,7 +39,7 @@ class UsedOptionAttribute extends CompositeAttribute
$this->attributes[$name]->setParent($this->plugin);
}
function loadAttrValue ($attrs)
function loadAttrValue (array $attrs)
{
if (isset($attrs[$this->getLdapName()])) {
$values = $attrs[$this->getLdapName()];
......@@ -90,7 +90,7 @@ class UsedOptionAttribute extends CompositeAttribute
return $value;
}
function writeValues ($values)
function writeValues (array $values)
{
return array_values($values);
}
......
......@@ -71,7 +71,7 @@ class SupannPrefixedSelectAttribute extends CompositeAttribute
$this->attributes[1]->resetToDefault();
}
function writeValues ($values)
function writeValues (array $values)
{
if ($values[0] == '') {
return '';
......@@ -132,7 +132,7 @@ class SupannCursusAnneeAttribute extends SupannPrefixedSelectAttribute
class SupannCompositeAttribute extends CompositeAttribute
{
function __construct($description, $ldapName, $attributes, $acl = "", $label = "Composite attribute")
function __construct($description, $ldapName, array $attributes, $acl = "", $label = "Composite attribute")
{
parent::__construct($description, $ldapName, $attributes, '', '', $acl, $label);
}
......@@ -154,7 +154,7 @@ class SupannCompositeAttribute extends CompositeAttribute
return $values;
}
function writeValues($values)
function writeValues(array $values)
{
$value = '';
$i = 0;
......
......@@ -206,7 +206,7 @@ class dashboardSystems extends simplePlugin
$nb_digits_suffix = $nb_digits - strlen($prefix);
/* generation of list of suffixe */
for ($d = $start_id;$d < pow(10, $nb_digits_suffix);$d++) {
for ($d = $start_id;$d < (10 ** $nb_digits_suffix);$d++) {
/* padding : 34 on 4 digit become : 0034*/
$array_complete_list[] = str_pad($d, $nb_digits_suffix, "0", STR_PAD_LEFT);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment