Output directly to file
authorkristianf <devnull@localhost>
Sun, 13 Oct 2013 16:54:12 +0000 (18:54 +0200)
committerkristianf <devnull@localhost>
Sun, 13 Oct 2013 16:54:12 +0000 (18:54 +0200)
keysigningPartyList.php

index 9bd68fc..04ee15d 100644 (file)
@@ -14,7 +14,9 @@
   // Initialize default values and read config file
   $conf = array(
        'title' => '<Undefined title>', 
-       'date' => '<Undefined date>');
+       'date' => '<Undefined date>',
+       'listfile' => 'key_party_list.html',
+       'fprfile' => 'fpr.txt');
   
   if(file_exists($homedir.'/ksp_conf'))
   {
                return $formatted_keyid;
        }
        
-       public function get_fpr()
+       public function get_fpr($formatted=true)
        {
+               if($formatted == false)
+                       return $this->fpr; 
+                       
                $formatted_fpr = "";
                
                if(strlen($this->fpr) == 40)
                        break;
        }
   }
-?>
+  
+  $fp_list = fopen($homedir."/{$conf['listfile']}", "w");
+  $fp_fpr = fopen($homedir."/{$conf['fprfile']}", "w");
+  
+  $tmp = <<<EOF
 <!DOCTYPE html
      PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
-  <title><?='Keyring for: '.$conf['title'].' on '.$conf['date'];?></title>
- </head>
- <body>
-  <?='Keyring for: '.$conf['title'].' on '.$conf['date']." .<br/>Last updated: ".date("Y-m-d");?>
+EOF;
+  fputs($fp_list, $tmp);
+  $tmp = "<title>Keyring for: {$conf['title']} on {$conf['date']}</title>";
+  $tmp .= "</head>"; 
+  $tmp .= "<body>";
+  $tmp .= "Keyring for: {$conf['title']} on {$conf['date']} <br/>Last updated: ".date("Y-m-d");
+  fputs($fp_list, $tmp);
+  $tmp = <<<EOF
   <table border="1">
    <tr>
        <th>Key ID</th>
        <th>Key info matches?</th>
        <th>Owner ID matches?</th>
    </tr>
-   <?php
+EOF;
+    fputs($fp_list, $tmp);
     foreach($key_objects as $ks_obj)
     {
-       echo "<tr>";
-       echo "<td>{$ks_obj->get_keyid()}</td>";
-       echo "<td>{$ks_obj->get_uids()}</td>";
-       echo "<td>{$ks_obj->get_fpr()}</td>";
-       echo "<td>{$ks_obj->get_keylength()}</td>";
-       echo "<td>{$ks_obj->get_keytype()}</td>";
-       echo "<td>{$ks_obj->get_creation_date()}</td>";
-       echo "<td>&nbsp;</td>";
-       echo "<td>&nbsp;</td>";
-       echo "</tr>\n";
+        $tmp = "<tr>";
+       $tmp .= "<td>{$ks_obj->get_keyid()}</td>";
+       $tmp .= "<td>{$ks_obj->get_uids()}</td>";
+       $tmp .= "<td>{$ks_obj->get_fpr()}</td>";
+       $tmp .= "<td>{$ks_obj->get_keylength()}</td>";
+       $tmp .= "<td>{$ks_obj->get_keytype()}</td>";
+       $tmp .= "<td>{$ks_obj->get_creation_date()}</td>";
+       $tmp .= "<td>&nbsp;</td>";
+       $tmp .= "<td>&nbsp;</td>";
+       $tmp .= "</tr>\n";
+       fputs($fp_list, $tmp);
+       $tmp = $ks_obj->get_fpr(false)."\n";
+       fputs($fp_fpr, $tmp);
     }
-   ?>
+  $tmp = <<<EOF
   </table>
  </body>
 </html>
+EOF;
+ fputs($fp_list, $tmp);
+ fclose($fp_list);
+ fclose($fp_fpr);
+?>