Merge branch 'merge-bug-1177-893-1136-1123-1137' into release
authorBenny Baumann <BenBE@geshi.org>
Fri, 6 Sep 2013 03:40:36 +0000 (05:40 +0200)
committerBenny Baumann <BenBE@geshi.org>
Fri, 6 Sep 2013 03:40:36 +0000 (05:40 +0200)
Conflicts:
www/gpg.php

1  2 
www/gpg.php

diff --cc www/gpg.php
  */ ?>
  <?
        require_once("../includes/loggedin.php");
++<<<<<<< HEAD
 +      require_once("../includes/lib/general.php");
++=======
+       require_once('../includes/notary.inc.php');
++>>>>>>> merge-bug-1177-893-1136-1123-1137
  
          $id = 0; if(array_key_exists('id',$_REQUEST)) $id=intval($_REQUEST['id']);
        $oldid = $_REQUEST['oldid'] = array_key_exists('oldid',$_REQUEST) ? intval($_REQUEST['oldid']) : 0;
@@@ -83,36 -83,25 +87,44 @@@ function verifyEmail($email
        $state=0;
        if($oldid == "0" && $CSR != "")
        {
 -              $debugkey = $gpgkey = clean_gpgcsr($CSR);
+               if(!array_key_exists('CCA',$_REQUEST))
+               {
+                       showheader(_("My CAcert.org Account!"));
+                       echo _("You did not accept the CAcert Community Agreement (CCA), hit the back button and try again.");
+                       showfooter();
+                       exit;
+               }
 +              $err = runCommand('mktemp --directory /tmp/cacert_gpg.XXXXXXXXXX',
 +                              "",
 +                              $tmpdir);
 +              if (!$tmpdir)
 +              {
 +                      $err = true;
 +              }
  
 -              $tnam = tempnam('/tmp/', '__gpg');
 -              $fp = fopen($tnam, 'w');
 -              fwrite($fp, $gpgkey);
 -              fclose($fp);
 -              $debugpg = $gpg = trim(`gpg --with-colons --homedir /tmp 2>&1 < $tnam`);
 -              unlink($tnam);
 +              if (!$err)
 +              {
 +                      $err = runCommand("gpg --with-colons --homedir $tmpdir 2>&1",
 +                                      clean_gpgcsr($CSR),
 +                                      $gpg);
 +
 +                      `rm -r $tmpdir`;
 +              }
 +
 +              if ($err)
 +              {
 +                      showheader(_("Welcome to CAcert.org"));
 +
 +                      echo "<p style='color:#ff0000'>"._("There was an error parsing your key.")."</p>";
 +                      unset($_REQUEST['process']);
 +                      $id = $oldid;
 +                      unset($oldid);
 +                      exit();
 +              }
  
                $lines = "";
 -              $gpgarr = explode("\n", $gpg);
 +              $gpgarr = explode("\n", trim($gpg));
                foreach($gpgarr as $line)
                {
                        #echo "Line[]: $line <br/>\n";