From c5b6c8132c3e1c54de819aef57b3c95d639c5040 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 13 Aug 2020 17:30:35 +0200 Subject: [PATCH] fixed PHP message --- .../3rdParty/pla/lib/QueryRender.php | 151 +++++++++--------- 1 file changed, 72 insertions(+), 79 deletions(-) diff --git a/lam/templates/3rdParty/pla/lib/QueryRender.php b/lam/templates/3rdParty/pla/lib/QueryRender.php index 9d5118f6..fd907ea3 100644 --- a/lam/templates/3rdParty/pla/lib/QueryRender.php +++ b/lam/templates/3rdParty/pla/lib/QueryRender.php @@ -210,76 +210,73 @@ class QueryRender extends PageRender { echo '
'; echo '
'; - switch(get_request('format','REQUEST',false,$_SESSION[APPCONFIG]->getValue('search','display'))) { - case 'list': - foreach ($results as $dndetails) { - $dndetails = array_change_key_case($dndetails); + $format = get_request('format','REQUEST',false,$_SESSION[APPCONFIG]->getValue('search','display')); + if ($format === 'list') { + foreach ($results as $dndetails) { + $dndetails = array_change_key_case($dndetails); - # Temporarily set our DN, for rendering that leverages our DN (eg: JpegPhoto) - $this->template->setDN($dndetails['dn']); + # Temporarily set our DN, for rendering that leverages our DN (eg: JpegPhoto) + $this->template->setDN($dndetails['dn']); - echo ''; + echo '
'; - echo ''; - printf('',IMGDIR,get_icon($server->getIndex(),$dndetails['dn'])); + echo ''; + printf('', IMGDIR, get_icon($server->getIndex(), $dndetails['dn'])); - printf('', - $server->getIndex(),$this->template->getDNEncode(),htmlspecialchars(get_rdn($dndetails['dn']))); + printf('', + $server->getIndex(), $this->template->getDNEncode(), htmlspecialchars(get_rdn($dndetails['dn']))); + echo ''; + + printf('', + htmlspecialchars(dn_unescape($dndetails['dn']))); + + # Iterate over each attribute for this entry + foreach (explode(',', $ado) as $attr) { + # Ignore DN, we've already displayed it. + if ($attr == 'dn') + continue; + + if (!isset($dndetails[$attr])) + continue; + + # Set our object with our values + $afattrs[$attr]->clearValue(); + + if (is_array($dndetails[$attr])) + $afattrs[$attr]->initValue($dndetails[$attr]); + else + $afattrs[$attr]->initValue(array($dndetails[$attr])); + + echo ''; + echo ''; + + echo ''; + + echo ''; echo ''; - - printf('', - htmlspecialchars(dn_unescape($dndetails['dn']))); - - # Iterate over each attribute for this entry - foreach (explode(',',$ado) as $attr) { - # Ignore DN, we've already displayed it. - if ($attr == 'dn') - continue; - - if (! isset($dndetails[$attr])) - continue; - - # Set our object with our values - $afattrs[$attr]->clearValue(); - - if (is_array($dndetails[$attr])) - $afattrs[$attr]->initValue($dndetails[$attr]); - else - $afattrs[$attr]->initValue(array($dndetails[$attr])); - - echo ''; - echo ''; - - echo ''; - - echo ''; - echo ''; - } - - echo '
icon
icon%s%s
 dn%s
 '; + $this->draw('Name', $afattrs[$attr]); + echo ''; + $this->draw('CurrentValues', $afattrs[$attr]); + echo '
 dn%s
 '; - $this->draw('Name',$afattrs[$attr]); - echo ''; - $this->draw('CurrentValues',$afattrs[$attr]); - echo '
'; - echo '
'; } - break; - + echo ''; + echo '
'; + } + } + else { # Display the results. - case 'table': - if (! $results) { - echo _('Search returned no results'); + if (!$results) { + echo _('Search returned no results'); + } + else { - continue; - } - - printf('
',$counter); + printf('', $counter); echo '
'; - printf('',$server->getIndex()); + printf('', $server->getIndex()); foreach ($this->template->resultsdata[$base]['attrs'] as $attr) - printf('',$attr); + printf('', $attr); echo '
'; @@ -290,9 +287,9 @@ class QueryRender extends PageRender { echo ' '; echo ' '; - foreach (explode(',',$ado) as $attr) { + foreach (explode(',', $ado) as $attr) { echo ''; - $this->draw('Name',$afattrs[$attr]); + $this->draw('Name', $afattrs[$attr]); echo ''; } @@ -308,21 +305,21 @@ class QueryRender extends PageRender { $this->template->setDN($dndetails['dn']); printf('', - $j%2 ? 'even' : 'odd',$j,$j); + $j % 2 ? 'even' : 'odd', $j, $j); # Is mass action enabled. - if ($_SESSION[APPCONFIG]->getValue('mass','enabled')) - printf('',$j,$dndetails['dn']); + if ($_SESSION[APPCONFIG]->getValue('mass', 'enabled')) + printf('', $j, $dndetails['dn']); - $href = sprintf('cmd=template_engine&server_id=%s&dn=%s',$server->getIndex(),$this->template->getDNEncode()); + $href = sprintf('cmd=template_engine&server_id=%s&dn=%s', $server->getIndex(), $this->template->getDNEncode()); printf('icon', htmlspecialchars($href), - IMGDIR,get_icon($server->getIndex(),$dndetails['dn'])); + IMGDIR, get_icon($server->getIndex(), $dndetails['dn'])); # We'll clone our attribute factory attributes, since we need to add the values to them for rendering. - foreach (explode(',',$ado) as $attr) { + foreach (explode(',', $ado) as $attr) { # If the entry is blank, we'll draw an empty box and continue. - if (! isset($dndetails[$attr])) { + if (!isset($dndetails[$attr])) { echo ' '; continue; } @@ -330,10 +327,10 @@ class QueryRender extends PageRender { # Special case for DNs if ($attr == 'dn') { $dn_display = strlen($dndetails['dn']) > 40 - ? sprintf('%s...',htmlspecialchars($dndetails['dn']),htmlspecialchars(substr($dndetails['dn'],0,40))) + ? sprintf('%s...', htmlspecialchars($dndetails['dn']), htmlspecialchars(substr($dndetails['dn'], 0, 40))) : htmlspecialchars($dndetails['dn']); - printf('%s',htmlspecialchars($href),$dn_display); + printf('%s', htmlspecialchars($href), $dn_display); continue; } @@ -345,7 +342,7 @@ class QueryRender extends PageRender { $afattrs[$attr]->initValue(array($dndetails[$attr])); echo ''; - $this->draw('CurrentValues',$afattrs[$attr]); + $this->draw('CurrentValues', $afattrs[$attr]); echo ''; } @@ -353,10 +350,10 @@ class QueryRender extends PageRender { } # Is mass action enabled. - if ($_SESSION[APPCONFIG]->getValue('mass','enabled')) { - printf('',++$j%2 ? 'odd' : 'even'); - printf('',$counter); - printf('',2+count(explode(',',$ado))); + if ($_SESSION[APPCONFIG]->getValue('mass', 'enabled')) { + printf('', ++$j % 2 ? 'odd' : 'even'); + printf('', $counter); + printf('', 2 + count(explode(',', $ado))); foreach ($mass_actions as $display => $action) { echo '  '; @@ -370,11 +367,7 @@ class QueryRender extends PageRender { echo ''; echo '
'; echo "\n\n"; - - break; - - default: - printf('Have ID [%s], run this query for page [%s]',$this->template_id,$this->page); + } } echo '';