changeset 18:2b490ac5b128

Improve keygen vote key print output slightly.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 06 Dec 2012 18:26:25 +0200
parents b015c0dea42c
children 1e258de5511d
files keygen.php
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/keygen.php	Thu Dec 06 17:53:43 2012 +0200
+++ b/keygen.php	Thu Dec 06 18:26:25 2012 +0200
@@ -93,28 +93,29 @@
       $rows = 0;
       $nitem = 0;
       $total = 0;
+      $str = "";
 
       foreach ($res as $item)
       {
         $total++;
-        printf("%s%04d  -  %8s",
+        $str .= sprintf("%s%04d  -  %8s",
           $item["enabled"] ? "*" : " ",
           $item["id"], $item["key"]);
 
         if (++$nitem >= $maxItems)
         {
+          echo $str."\n".str_repeat("-", strlen($str))."\n";
+          $str = "";
           $nitem = 0;
-          echo "\n";
-
           if (++$rows % $maxRows == 0)
             echo "\f\n";
         }
         else
-          echo " | ";
+          $str .= " |";
       }
-
+      
       if ($nitem > 0)
-        echo "\n";
+        echo $str."\n";
 
       echo "Total of ".$total." ".($all ? "keys (all printed)" : "unactive keys")."\n";
     }