Commit 62a7bd5a authored by Benoit Mortier's avatar Benoit Mortier
Browse files

Cleaning minor sonar code compliance


Move this trailing comment on the previous empty line
Signed-off-by: default avatarBenoit Mortier <benoit.mortier@opensides.be>
parent 83d3f522
......@@ -43,12 +43,10 @@ class mailAliasDistribution extends simplePlugin
);
}
// The main function : information about attributes
static function getAttributesInfo ()
{
global $config;
return array(
// Attributes are grouped by section
'main' => array(
'name' => _('Mail distribution'),
'attrs' => array(
......@@ -76,7 +74,8 @@ class mailAliasDistribution extends simplePlugin
new DateAttribute(
_('Expiration date'), _('Date after which the alias should be deleted. Leave empty for no deletion.'),
'aliasExpirationDate', FALSE,
'U', // Unix timestamp
// Unix timestamp
'U',
''
)
)
......
......@@ -43,11 +43,9 @@ class mailAliasRedirection extends simplePlugin
);
}
// The main function : information about attributes
static function getAttributesInfo ()
{
return array(
// Attributes are grouped by section
'main' => array(
'name' => _('Mail redirection'),
'attrs' => array(
......@@ -72,7 +70,8 @@ class mailAliasRedirection extends simplePlugin
new DateAttribute(
_('Expiration date'), _('Date after which the redirection should be deleted. Leave empty for no deletion.'),
'aliasExpirationDate', FALSE,
'U', // Unix timestamp
// Unix timestamp
'U',
''
)
)
......
......@@ -188,8 +188,8 @@ class argonautQueue extends simpleManagement
if ($this->o_queue->is_error()) {
msg_dialog::display(_('Info'), sprintf(_('%s'), $this->o_queue->get_error()), INFO_DIALOG);
}
$this->o_queue->remove_entries($taskids); // Removing the task.
/* Removing the task. */
$this->o_queue->remove_entries($taskids);
}
function processNow($action = '', $target = array(), $all = array())
......
......@@ -225,7 +225,8 @@ class supportDaemon
return $status[0];
} catch (jsonRPCClient_RequestErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
$this->new_state(TRUE); // connection is OK
/* connection is OK */
$this->new_state(TRUE);
return FALSE;
} catch (jsonRPCClient_NetworkErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
......@@ -331,7 +332,7 @@ class supportDaemon
*
* \return array All queued entries as an array or FALSE if there is an error.
*/
public function get_queued_entries() //$event_types = array("*"),$from=-1,$to=-1,$sort="timestamp DESC"
public function get_queued_entries()
{
if ($this->s_host == "") {
$this->set_error($this->host_error);
......@@ -394,7 +395,8 @@ class supportDaemon
return $this->new_state(TRUE);
} catch (jsonRPCClient_RequestErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
$this->new_state(TRUE); // connection is OK
/* connection is OK */
$this->new_state(TRUE);
return FALSE;
} catch (jsonRPCClient_NetworkErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
......@@ -454,7 +456,8 @@ class supportDaemon
return $this->new_state(TRUE);
} catch (jsonRPCClient_RequestErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
$this->new_state(TRUE); // connection is OK
/* connection is OK */
$this->new_state(TRUE);
return FALSE;
} catch (jsonRPCClient_NetworkErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
......@@ -528,7 +531,8 @@ class supportDaemon
return $entries;
} catch (jsonRPCClient_RequestErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
$this->new_state(TRUE); // connection is OK
/* connection is OK */
$this->new_state(TRUE);
return FALSE;
} catch (jsonRPCClient_NetworkErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
......@@ -629,7 +633,8 @@ class supportDaemon
return $client->ping($mac);
} catch (jsonRPCClient_RequestErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
$this->new_state(TRUE); // connection is OK
/* connection is OK */
$this->new_state(TRUE);
return FALSE;
} catch (jsonRPCClient_NetworkErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
......@@ -664,7 +669,8 @@ class supportDaemon
if ($this->saved_state() == FALSE) {
return array();
}
if ($package_list) { // filters is a package name list
/* filters is a package name list */
if ($package_list) {
foreach ($filters as &$filter) {
$filter = "^".$this->escape_perl_chars($filter)."$";
}
......@@ -699,7 +705,8 @@ class supportDaemon
return $to_return;
} catch (jsonRPCClient_RequestErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
$this->new_state(TRUE); // connection is OK
/* connection is OK */
$this->new_state(TRUE);
return array();
} catch (jsonRPCClient_NetworkErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
......@@ -763,7 +770,8 @@ class supportDaemon
return $this->new_state(TRUE);
} catch (jsonRPCClient_RequestErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
$this->new_state(TRUE); // connection is OK
/* connection is OK */
$this->new_state(TRUE);
return FALSE;
} catch (jsonRPCClient_NetworkErrorException $e) {
$this->set_error(nl2br($e->getMessage()));
......
......@@ -425,7 +425,8 @@ class mailMethodCyrus extends mailMethod
$acls = imap_getacl ($this->imap_handle, $this->account_id);
foreach ($acls as $user => $acl) {
if ($user == "anyone") {
$user = "__anyone__"; // Map to internal placeholder
/* Map to internal placeholder */
$user = "__anyone__";
}
$folder_acls[$user] = $acl;
}
......
......@@ -53,8 +53,6 @@ class DebconfEntriesAttribute extends CompositeAttribute
$this->attributes[$cn] = new StringAttribute ($cn, $desc, "debconfentry_$cn", FALSE, $default);
$this->attributes[$cn]->setInLdap(FALSE);
$this->attributes[$cn]->setAcl($this->getAcl());
//~ 'choices'
//~ 'extendedDescription'
}
}
$ldap->cd("ou=questions,".$this->plugin->dn);
......@@ -64,10 +62,8 @@ class DebconfEntriesAttribute extends CompositeAttribute
$cn = $entry['cn'][0];
if (isset($this->attributes[$cn])) {
$this->attributes[$cn]->setValue($entry['value'][0]);
$this->attributes[$cn]->loadValue(NULL); // set initialValue
//~ 'flags'
//~ 'owners'
//~ 'template'
/* set initialValue */
$this->attributes[$cn]->loadValue(NULL);
} else {
msg_dialog::display(_("Error"), _("There is no template for this profile"), ERROR_DIALOG);
}
......@@ -115,11 +111,14 @@ class DebconfImportAttribute extends FileAttribute
$matches = array();
$str = fread($handle, 1024);
strpos($str, "dn:");
$tmp = str_replace ("\n", "", $str); // removing breaklines
$tmp = str_replace (" ", "", $tmp); // removing spaces
/* removing breaklines */
$tmp = str_replace ("\n", "", $str);
/* removing spaces */
$tmp = str_replace (" ", "", $tmp);
/* searching for dn: containing the template name */
if (preg_match( "/dn:.*,ou=templates,ou=([^,=]+),".get_ou("debconfRDN").
$config->current['BASE']."/",
$tmp, $matches) > 0) { // searching for dn: containing the template name
$tmp, $matches) > 0) {
$this->plugin->attributesAccess['ou']->setPostValue($matches[1]);
$this->plugin->attributesAccess['ou']->setValue($matches[1]);
$this->plugin->attributesAccess['ou']->setDisabled(TRUE);
......
......@@ -372,7 +372,8 @@ class DnsRecordAttribute extends CompositeAttribute
$this->attributes[2]->setVisible(FALSE);
}
}
$this->setAttributes($this->attributes); // Update ACLs
/* Update ACLs */
$this->setAttributes($this->attributes);
}
function applyPostValue()
......
......@@ -89,7 +89,8 @@ class EjbcaUserCertsAttribute extends GenericDialogAttribute
{
$id = $this->getHtmlId();
$div = new divSelectBox($id);
$displays = $this->getDisplayValues(); // Updates and get display values
/* Updates and get display values */
$displays = $this->getDisplayValues();
foreach ($displays as $key => $display_item) {
$fields = array(
array('string' => $display_item['cn'][0])
......
......@@ -268,20 +268,24 @@ class PackagesAttribute extends DialogOrderedArrayAttribute
return;
}
/* If there are no packages, no need to do anything */
if (empty($this->value)) {
return; // If there are no packages, no need to do anything
return;
}
$attrs = array('distribution','package','version','section','description','timestamp','hastemplate');
$packages = array_diff_key($this->value, $this->buffer); // packages names that are not already in the buffer
/* packages names that are not already in the buffer */
$packages = array_diff_key($this->value, $this->buffer);
$release = $this->plugin->FAIdebianRelease;
$q = new supportDaemon();
$customs = serviceRepository::getCustomReleases($release);
for ($i = -1; (count($packages) > 0) && ($i < count($customs)); $i++) {
if ($i >= 0) { // if release has been handled
$release = $customs[$i]; // take the next custom
/* if release has been handled */
if ($i >= 0) {
/* take the next custom */
$release = $customs[$i];
}
$ret = $q->FAI_get_packages($release, $attrs, array_keys($packages), -1, -1, TRUE);
if ($q->is_error()) {
......@@ -293,7 +297,8 @@ class PackagesAttribute extends DialogOrderedArrayAttribute
$attr['DESCRIPTION'] = '';
}
$this->buffer[$attr['PACKAGE']] = $attr;
unset($packages[$attr['PACKAGE']]); // remove found packages
/* remove found packages */
unset($packages[$attr['PACKAGE']]);
if ($i >= 0) {
$this->FAIcustomRelease[$release] = $release;
}
......
......@@ -29,7 +29,8 @@ class AvailableLogsAttribute extends Attribute
'file' => '',
'time' => '',
'sort_by' => 'time',
'sort_up' => TRUE // TRUE means up
/* TRUE means up */
'sort_up' => TRUE
);
parent::__construct ('', $description, $ldapName, FALSE, $value, $acl);
$this->setInLdap(FALSE);
......
......@@ -178,9 +178,11 @@ class serviceRepository extends simpleService
_('Repositories this server hosts'),
'FAIrepository'
),
FALSE, // no order
/* no order */
FALSE,
array(),
TRUE // edit button
/* edit button */
TRUE
)
)
)
......
......@@ -44,29 +44,28 @@ class freeradiusGroup extends simplePlugin {
static function getAttributesInfo ()
{
return array(
// Attributes are grouped by section
'section1' => array(
'name' => _('Support 802.1x'),
'attrs' => array(
new StringAttribute(
_('Tunnel medium type'), // Label of the attribute
_('Name of the tunnel medium type'), // Description
'radiusTunnelMediumType', // LDAP name
TRUE, // Mandatory
'IEEE-802' // default value
_('Tunnel medium type'),
_('Name of the tunnel medium type'),
'radiusTunnelMediumType',
TRUE,
'IEEE-802'
),
new StringAttribute(
_('Tunnel type'), // Label of the attribute
_('Name of the tunnel type'), // Description
'radiusTunnelType', // LDAP name
TRUE, // Mandatory
'VLAN' // default value
_('Tunnel type'),
_('Name of the tunnel type'),
'radiusTunnelType',
TRUE,
'VLAN'
),
new StringAttribute(
_('VLAN id'), // Label of the attribute
_('VLAN identifier'), // Description
'radiusTunnelPrivateGroupId', // LDAP name
FALSE, // Mandatory
_('VLAN id'),
_('VLAN identifier'),
'radiusTunnelPrivateGroupId',
FALSE,
''
)
)
......
......@@ -23,7 +23,7 @@
class freeradiusAccount extends simplePlugin {
var $displayHeader = TRUE; // If we want the button Add/Delete
var $displayHeader = TRUE;
var $objectclasses = array('radiusprofile');
/*!
......@@ -36,7 +36,7 @@ class freeradiusAccount extends simplePlugin {
'plDescription' => _('This Plugin is for Radius accounting based in FreeRadius'),
'plIcon' => 'geticon.php?context=applications&icon=freeradius&size=48',
'plSmallIcon' => 'geticon.php?context=applications&icon=freeradius&size=16',
'plSelfModify' => TRUE, // Does this plugin have an owner that might be able to edit its entry
'plSelfModify' => TRUE,
'plPriority' => 11,
'plObjectType' => array('user'),
......@@ -50,7 +50,6 @@ class freeradiusAccount extends simplePlugin {
static function getAttributesInfo ()
{
return array(
// Attributes are grouped by section
'section1' => array(
'name' => _('Support 802.1x'),
'attrs' => array(
......@@ -79,13 +78,13 @@ class freeradiusAccount extends simplePlugin {
'section2' => array(
'name' => _('Groups'),
'attrs' => array(
new SetAttribute( // This attribute is multi-valuated
new SetAttribute(
new SelectAttribute (
_('Groups'), // Label of the attribute
_('FreeRadius Group'), // Description
'radiusGroupName', // LDAP name
FALSE, // Mandatory
array("") // [SelectAttribute] Choices
_('Groups'),
_('FreeRadius Group'),
'radiusGroupName',
FALSE,
array("")
)
),
),
......@@ -111,9 +110,9 @@ class freeradiusAccount extends simplePlugin {
new IntAttribute(
_('Framed-MTU'), _('Framed-MTU'),
'radiusFramedMTU', FALSE,
0, // [FloatAttribute] Minimum value
FALSE, // [FloatAttribute] No maximum value
1500 // [FloatAttribute] Default value
0,
FALSE,
1500
),
new StringAttribute(
_('Compression'), _('Compression'),
......@@ -127,10 +126,10 @@ class freeradiusAccount extends simplePlugin {
),
new IntAttribute(
_('Session Timeout'), _('Session Timeout'),
'radiusSessionTimeout', FALSE, // Mandatory
FALSE, // no minimum value
FALSE, // no maximum value
"" // no default value
'radiusSessionTimeout', FALSE,
FALSE,
FALSE,
""
),
new IntAttribute(
_('Idle Timeout'), _('Idle Timeout'),
......
......@@ -109,12 +109,14 @@ class pgpKeySelect extends simpleSelectManagement
static function pgpSize($size)
{
return strval(intval($size)); // Remove useless 0 at the beginning
/* Remove useless 0 at the beginning */
return strval(intval($size));
}
static function pgpRevoked($value)
{
return ($value == 0?'No':'Yes'); // Remove useless 0 at the beginning
/* Remove useless 0 at the beginning */
return ($value == 0?'No':'Yes');
}
}
......@@ -193,14 +195,16 @@ class PgpKeyAttribute extends GenericDialogAttribute
$headers = array_values($this->displayed_values);
$headers[] = '';
$div->SetHeaders($headers);
$displays = $this->getDisplayValues(); // Updates and get display values
/* Updates and get display values */
$displays = $this->getDisplayValues();
foreach ($displays as $key => $display_item) {
$fields = array();
foreach (array_keys($this->displayed_values) as $field) {
if (isset($display_item[$field][0]) && !empty($display_item[$field][0])) {
$display = $display_item[$field][0];
if ($field == 'pgpKeySize') {
$display = pgpKeySelect::pgpSize($display); // Remove useless 0 in front of the number
/* Remove useless 0 in front of the number */
$display = pgpKeySelect::pgpSize($display);
} elseif ($field == 'pgpKeyCreateTime') {
$display = pgpKeySelect::pgpDate($display);
} elseif ($field == 'pgpKeyExpireTime') {
......
......@@ -144,8 +144,10 @@ class serviceKolab extends simpleService
_('Quota occupation limit before warning users (%)'),
_('Warn users when using more than X% of their mail quota'),
'cyrus-quotawarn', FALSE,
FALSE, FALSE, // min and max
80 // default value
/* min and max */
FALSE, FALSE,
/* default value */
80
)
)
),
......@@ -161,8 +163,10 @@ class serviceKolab extends simpleService
_('Number of days to include when creating free/busy lists'),
_('Include data from X days in the past when creating free/busy lists'),
'kolabFreeBusyFuture', FALSE,
FALSE, FALSE, // min and max
1 // default value
/* min and max */
FALSE, FALSE,
/* default value */
1
)
)
),
......
......@@ -168,8 +168,9 @@ class ldapmanager extends simplePlugin
function save_export($dn, $acl, $scope, $name)
{
global $config;
if (!empty($dn)) { // An LDIF export was asked
// Check permissions
if (!empty($dn)) {
/* An LDIF export was asked */
/* Check permissions */
if (!$this->acl_is_writeable($acl, $this->acl_skip_write())) {
msg_dialog::display(_('Permission error'),
sprintf(_('You have no permission to export %s!'), bold(LDAP::fix($dn))),
......
Supports Markdown
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