From 036a16a03147b046e0b1cf358a606d5f6793ccd7 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 8 Mar 2017 17:19:44 +0100 Subject: [PATCH] fixed issues with empty (#26) --- lam/lib/pdf.inc | 5 +++-- lam/templates/login2Factor.php | 3 ++- lam/tests/lib/LAMConfigTest.php | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lam/lib/pdf.inc b/lam/lib/pdf.inc index d06e3eec..83c888fe 100644 --- a/lam/lib/pdf.inc +++ b/lam/lib/pdf.inc @@ -212,9 +212,10 @@ function printLabelValue(&$pdf, $valueEntry, $fontName) { * @param string $fontName font name */ function printTable(&$pdf, $table, $fontName) { - if (!empty($table->getHeadline())) { + $headline = $table->getHeadline(); + if (!empty($headline)) { $pdf->SetFont($fontName, 'B', LAMPDF_FONT_SIZE); - $pdf->Cell(LAMPDF_LABELWIDTH, LAMPDF_LINEHEIGHT, $table->getHeadline() . ':', 0 , 0, 'L', 0); + $pdf->Cell(LAMPDF_LABELWIDTH, LAMPDF_LINEHEIGHT, $headline . ':', 0 , 0, 'L', 0); $pdf->Ln(LAMPDF_LINEHEIGHT); } foreach ($table->rows as $row) { diff --git a/lam/templates/login2Factor.php b/lam/templates/login2Factor.php index f3d63932..ce1f458b 100644 --- a/lam/templates/login2Factor.php +++ b/lam/templates/login2Factor.php @@ -66,7 +66,8 @@ catch (\Exception $e) { die(); } -$twoFactorLabel = empty($config->getTwoFactorAuthenticationLabel()) ? _('PIN+Token') : $config->getTwoFactorAuthenticationLabel(); +$twoFactorLabelConfig = $config->getTwoFactorAuthenticationLabel(); +$twoFactorLabel = empty($twoFactorLabelConfig) ? _('PIN+Token') : $twoFactorLabelConfig; if (sizeof($serials) == 0) { if ($config->getTwoFactorAuthenticationOptional()) { diff --git a/lam/tests/lib/LAMConfigTest.php b/lam/tests/lib/LAMConfigTest.php index 747f1c50..f04ff38a 100644 --- a/lam/tests/lib/LAMConfigTest.php +++ b/lam/tests/lib/LAMConfigTest.php @@ -695,7 +695,8 @@ class LAMConfigTest extends PHPUnit_Framework_TestCase { * Tests LAMConfig->getJobToken() */ public function testGetJobToken() { - $this->assertFalse(empty($this->lAMConfig->getJobToken())); + $token = $this->lAMConfig->getJobToken(); + $this->assertFalse(empty($token)); } /**