Add --batch for 2.x support
authorkristianf <devnull@localhost>
Wed, 13 Aug 2014 19:00:50 +0000 (21:00 +0200)
committerkristianf <devnull@localhost>
Wed, 13 Aug 2014 19:00:50 +0000 (21:00 +0200)
emailclass.inc.php

index 295ef18..5cbfa19 100644 (file)
  class sendmail_gpgsign extends sendmail_gpgbase
  {
   protected $gpg_signing_key="";
-  protected $gpg_algo = "sha1";
+  protected $gpg_algo = "sha256";
   
   public function gpg_set_signing_key($key){$this->gpg_signing_key=escapeshellcmd($key);}
   public function gpg_set_algo($algo){$this->gpg_algo=escapeshellcmd($algo);}
    
    if($this->gpg_homedir=="") die("You need to specify a homedir to use asymmetrical encryption");
    
-   $gpg_command = "--homedir {$this->gpg_homedir} ".(($this->gpg_version=="1.4") ? " --trust-model always" : " --always-trust")." --no-tty --comment \"KF Webs PHP Mail Class [http://www.kfwebs.net]\" --command-fd 0 -u {$this->gpg_signing_key} -asbt";
+   $gpg_command = "--batch --homedir {$this->gpg_homedir} ".(($this->gpg_version=="1.4") ? " --trust-model always" : " --always-trust")." --no-tty --comment \"KF Webs PHP Mail Class [http://www.kfwebs.net]\" --command-fd 0 -u {$this->gpg_signing_key} -asbt";
    $gpg_command_use = $this->gpg_path." {$gpg_command} --digest-algo {$this->gpg_algo}";
    $gpg_command_use = "cat $tmp | $gpg_command_use > $tmp.asc";
    $a = `$gpg_command_use`;
    {
     $gpg_key_list = "";
     if($this->gpg_homedir=="") die("You need to specify a homedir to use asymmetrical encryption");
-    $this->gpg_command = "--homedir {$this->gpg_homedir} ".(($this->gpg_version=="1.4") ? " --trust-model always" : " --always-trust")." --no-tty --comment \"KF Webs PHP Mail Class [http://www.kfwebs.net]\" --command-fd 0 ".(($this->gpg_signing_key!="") ? " -u {$this->gpg_signing_key} " : "")."-a".(($this->gpg_sign==1) ? "s" : "")."e";
+    $this->gpg_command = "--batch --homedir {$this->gpg_homedir} ".(($this->gpg_version=="1.4") ? " --trust-model always" : " --always-trust")." --no-tty --comment \"KF Webs PHP Mail Class [http://www.kfwebs.net]\" --command-fd 0 ".(($this->gpg_signing_key!="") ? " -u {$this->gpg_signing_key} " : "")."-a".(($this->gpg_sign==1) ? "s" : "")."e";
     foreach($this->gpg_keys as $abcd)
     {
      $gpg_key_list .= " -r {$abcd}";
    }
    else
    {
-    $this->gpg_command = "--homedir /tmp/ --no-tty --comment \"KF Webs PHP Mail Class [http://www.kfwebs.net]\" --command-fd 0 -ac";
+    $this->gpg_command = "--batch --homedir /tmp/ --no-tty --comment \"KF Webs PHP Mail Class [http://www.kfwebs.net]\" --command-fd 0 -ac";
     $this->gpg_command_use = "echo \"{$this->gpg_key}\" | ".$this->gpg_path." --cipher-algo ".$this->gpg_algo." ".$this->gpg_command." ".$tmp." 2>&1";
    }
    $a = `$this->gpg_command_use`;