26a27
> require_once(SM_PATH . 'functions/sig.php');
427a429,471
>
> $sigstatus = 0;
>
> if($header->x_sig != null) {
> $x_sig = str_replace("\n", "", $header->x_sig);
> $x_sig = str_replace(" ", "", $header->x_sig);
> $env[_("X-Sig")] = substr($x_sig, 0, 60) . "...";
>
> $file = fopen("/tmp/sig", "w");
> fwrite($file, $x_sig . "\n");
> fclose($file);
> $cmd = "/usr/local/java/bin/java -classpath ~rose/src/email Sig verify " . $from_name . " < /tmp/sig 2>&1";
> $sigsum = exec($cmd);
> // print $sigsum;
>
> if(strcmp($sigsum, $header->md5) == 0) {
> $sigstatus = 1;
> } else {
> $sigstatus = -1;
> }
>
> } else {
> $env[_("X-Sig")] = "Not signed!";
> }
>
> $env[_("MD5")] = $header->md5;
>
> /*
> print "
";
>
> while(list($k,$v)=each($header)) {
> print "Prop: $k = $v
";
> }
>
> print $header->message_id;
>
> foreach($env as $key => $val) {
> print "Env: " . $key . " = " . $val;
> }
>
> print "
";
> */
>
484a529,552
>
> // write signature status block
> if($sigstatus < 0) {
> $sigcolor = "#FF0000";
> $sigstr = "WARNING: Signature verification failed!
" . $sigsum;
> } else if($sigstatus == 0) {
> $sigcolor = $color[4];
> $sigstr = "No signature available: The sender of this email could not be verified";
> } else {
> $sigcolor = "#FFFFAA";
> $sigstr = "Signature verified: This email was sent by " . $env[_("From")] . "";
> }
>
> echo '
' CELLSPACING="0" BORDER="0" ALIIGN="center">'."\n";
> echo ' |
'."\n";
> echo ' echo ' ALIGN="center" BGCOLOR="' . $sigcolor . '">';
> echo '| ';
> echo $sigstr;
> echo ' | ';
> echo ' ';
> echo ' |
|
'."\n";
> echo '
';
769a838,862
>
> //
> // Calculate message md5
> //
>
> $data = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[]", true, $response, $msg, $uid_support);
> $emptylines = 0;
> $complete_body = "";
> for($i = 0; $i < count($data) - 2; $i++) {
> if($emptylines > 0) {
> $complete_body .= $data[$i];
> }
> if(trim($data[$i]) == "") {
> $emptylines++;
> }
> // print $data[$i] . "
";
> }
>
> // nuke \r\n.. turn it into just \n
> $complete_body = str_replace("\r\n", "\n", $complete_body);
> //print $complete_body;
> $message->rfc822_header->md5 = md5sum($complete_body);
>
>
>
810a904
> //print $messagebody;