refactoring

This commit is contained in:
Roland Gruber 2017-10-24 20:43:28 +02:00
parent 09fd516f9f
commit 8629b5d867
3 changed files with 13 additions and 13 deletions

View File

@ -70,7 +70,7 @@ if (!empty($_POST)) {
$typeManager = new \LAM\TYPES\TypeManager(); $typeManager = new \LAM\TYPES\TypeManager();
if (isset($_POST['type']) && ($typeManager->getConfiguredType($_POST['type']) == null)) { if (isset($_POST['type']) && ($typeManager->getConfiguredType($_POST['type']) === null)) {
logNewMessage(LOG_ERR, 'Invalid type: ' . $_POST['type']); logNewMessage(LOG_ERR, 'Invalid type: ' . $_POST['type']);
die(); die();
} }
@ -78,7 +78,7 @@ if (isset($_POST['type']) && ($typeManager->getConfiguredType($_POST['type']) ==
if (isset($_GET['type']) && isset($_SESSION['delete_dn'])) { if (isset($_GET['type']) && isset($_SESSION['delete_dn'])) {
$typeId = $_GET['type']; $typeId = $_GET['type'];
$type = $typeManager->getConfiguredType($typeId); $type = $typeManager->getConfiguredType($typeId);
if ($type == null) { if ($type === null) {
logNewMessage(LOG_ERR, 'Invalid type: ' . $type->getId()); logNewMessage(LOG_ERR, 'Invalid type: ' . $type->getId());
die(); die();
} }

View File

@ -142,7 +142,7 @@ if( $view == 'syntaxes' ) {
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n";
echo "<td>"._('Description')."</td>\n"; echo "<td>"._('Description')."</td>\n";
echo "<td>" . ( $attr->getDescription() == null ? '('._('No description').')' : $attr->getDescription() ). "</td>\n"; echo "<td>" . ( $attr->getDescription() === null ? '('._('No description').')' : $attr->getDescription() ). "</td>\n";
echo "</tr>\n\n"; echo "</tr>\n\n";
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n";
echo "<td><acronym title=\"Object Identier\">"._('OID')."</acronym></td>\n"; echo "<td><acronym title=\"Object Identier\">"._('OID')."</acronym></td>\n";
@ -157,7 +157,7 @@ if( $view == 'syntaxes' ) {
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n";
echo "<td>"._('Inherits from')."</td>\n"; echo "<td>"._('Inherits from')."</td>\n";
echo "<td>"; echo "<td>";
if( $attr->getSupAttribute()==null ) if( $attr->getSupAttribute() === null )
echo '('._('none').')'; echo '('._('none').')';
else else
echo "<a href=\"?view=$view&amp;viewvalue=" . strtolower( $attr->getSupAttribute() ) . "\">" . $attr->getSupAttribute() . "</a></td>\n"; echo "<a href=\"?view=$view&amp;viewvalue=" . strtolower( $attr->getSupAttribute() ) . "\">" . $attr->getSupAttribute() . "</a></td>\n";
@ -165,23 +165,23 @@ if( $view == 'syntaxes' ) {
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n";
echo "<td>"._('Equality')."</td>\n"; echo "<td>"._('Equality')."</td>\n";
echo "<td>" . ( $attr->getEquality() == null ? '('._('not specified').')' : "<a href=\"?view=matching_rules&amp;viewvalue=".$attr->getEquality()."\">".$attr->getEquality()."</a>" ) . "</td>\n"; echo "<td>" . ( $attr->getEquality() === null ? '('._('not specified').')' : "<a href=\"?view=matching_rules&amp;viewvalue=".$attr->getEquality()."\">".$attr->getEquality()."</a>" ) . "</td>\n";
echo "</tr>\n\n"; echo "</tr>\n\n";
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n";
echo "<td>"._('Ordering')."</td>\n"; echo "<td>"._('Ordering')."</td>\n";
echo "<td>" . ( $attr->getOrdering()==null? '('._('not specified').')' : $attr->getOrdering() ) . "</td>\n"; echo "<td>" . ( $attr->getOrdering() === null? '('._('not specified').')' : $attr->getOrdering() ) . "</td>\n";
echo "</tr>\n\n"; echo "</tr>\n\n";
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n";
echo "<td>"._('Substring Rule')."</td>\n"; echo "<td>"._('Substring Rule')."</td>\n";
echo "<td>" . ( $attr->getSubstr()==null? '('._('not specified').')' : $attr->getSubstr() ) . "</td>\n"; echo "<td>" . ( $attr->getSubstr() === null? '('._('not specified').')' : $attr->getSubstr() ) . "</td>\n";
echo "</tr>\n\n"; echo "</tr>\n\n";
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n";
echo "<td>"._('Syntax')."</td>\n"; echo "<td>"._('Syntax')."</td>\n";
echo "<td>"; echo "<td>";
if( null != $attr->getType() ) { if( null !== $attr->getType() ) {
echo "<a href=\"?view=syntaxes&amp;highlight_oid="; echo "<a href=\"?view=syntaxes&amp;highlight_oid=";
echo $attr->getSyntaxOID() . "#" . $attr->getSyntaxOID(); echo $attr->getSyntaxOID() . "#" . $attr->getSyntaxOID();
echo "\">" . $attr->getType() . " (" . $attr->getSyntaxOID() . ")</a>"; echo "\">" . $attr->getType() . " (" . $attr->getSyntaxOID() . ")</a>";
@ -275,10 +275,10 @@ if( $view == 'syntaxes' ) {
$counter++; $counter++;
$oid = htmlspecialchars( $rule->getOID() ); $oid = htmlspecialchars( $rule->getOID() );
$desc = htmlspecialchars( $rule->getName() ); $desc = htmlspecialchars( $rule->getName() );
if ( $viewvalue==null || $viewvalue==($rule->getName() )) { if ( $viewvalue === null || $viewvalue==($rule->getName() )) {
if( ! is_null( $viewvalue ) ) if( ! is_null( $viewvalue ) )
$viewed = true; $viewed = true;
if( null != $rule->getDescription() ) if( null !== $rule->getDescription() )
$desc .= ' (' . $rule->getDescription() . ')'; $desc .= ' (' . $rule->getDescription() . ')';
if( true === $rule->getIsObsolete() ) if( true === $rule->getIsObsolete() )
$desc .= ' <span style="color:red">' . _('Obsolete') . '</span>'; $desc .= ' <span style="color:red">' . _('Obsolete') . '</span>';
@ -336,7 +336,7 @@ if( $view == 'syntaxes' ) {
<br /> <br />
<?php foreach( $schema_oclasses as $name => $oclass ) { <?php foreach( $schema_oclasses as $name => $oclass ) {
if ( $viewvalue==null || 0 == strcasecmp( $viewvalue, $oclass->getName() ) ){ if ( $viewvalue === null || 0 == strcasecmp( $viewvalue, $oclass->getName() ) ){
if( ! is_null( $viewvalue ) ) if( ! is_null( $viewvalue ) )
$viewed = true; $viewed = true;
?> ?>
@ -347,7 +347,7 @@ if( $view == 'syntaxes' ) {
<h4 class="schema_oclass_sub"><?php echo _('Description'); ?>: <b><?php echo $oclass->getDescription(); ?></b></h4> <h4 class="schema_oclass_sub"><?php echo _('Description'); ?>: <b><?php echo $oclass->getDescription(); ?></b></h4>
<?php } ?> <?php } ?>
<h4 class="schema_oclass_sub"><?php echo _('Type'); ?>: <b><?php echo $oclass->getType(); ?></b></h4> <h4 class="schema_oclass_sub"><?php echo _('Type'); ?>: <b><?php echo $oclass->getType(); ?></b></h4>
<?php if( $oclass->getIsObsolete() == true ) { ?> <?php if( $oclass->getIsObsolete() === true ) { ?>
<h4 class="schema_oclass_sub"><?php echo _('This object class is obsolete.'); ?></h4> <h4 class="schema_oclass_sub"><?php echo _('This object class is obsolete.'); ?></h4>
<?php } ?> <?php } ?>

View File

@ -169,7 +169,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
// check if values in unique columns are correct // check if values in unique columns are correct
for ($i = 0; $i < sizeof($columns); $i++) { for ($i = 0; $i < sizeof($columns); $i++) {
if (isset($columns[$i]['unique']) && ($columns[$i]['unique'] == true) && isset($ids[$columns[$i]['name']])) { if (isset($columns[$i]['unique']) && ($columns[$i]['unique'] === true) && isset($ids[$columns[$i]['name']])) {
$colNumber = $ids[$columns[$i]['name']]; $colNumber = $ids[$columns[$i]['name']];
$values_given = array(); $values_given = array();
foreach ($data as $dataRow) { foreach ($data as $dataRow) {