bug fixes
authorTim Starling <tstarling@users.mediawiki.org>
Sun, 9 May 2004 06:03:54 +0000 (06:03 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sun, 9 May 2004 06:03:54 +0000 (06:03 +0000)
includes/DefaultSettings.php
includes/SpecialBoardvote.php

index 1490f9f..8c6f07c 100644 (file)
@@ -375,5 +375,5 @@ $wgContributingCandidates = array();
 $wgVolunteerCandidates = array();
 $wgGPGCommand = "gpg";
 $wgGPGRecipient = "boardvote";
-
+$wgGPGHomedir = false;
 ?>
index 1555eb4..2984bd5 100644 (file)
@@ -174,10 +174,10 @@ class BoardVoteForm {
        
        function encrypt( $contributing, $volunteer ) {
                global $wgVolunteerCandidates, $wgContributingCandidates;
-               global $wgGPGCommand, $wgGPGRecipient;
+               global $wgGPGCommand, $wgGPGRecipient, $wgGPGHomedir;
                $file = @fopen( "/dev/urandom", "r" );
                if ( $file ) {
-                       $salt = implode( "", unpack( fread( $file, 64 ), "H*" ));
+                       $salt = implode( "", unpack( "H*", fread( $file, 64 ) ));
                        fclose( $file );
                } else {
                        $salt = Parser::getRandomString() . Parser::getRandomString();
@@ -198,7 +198,11 @@ class BoardVoteForm {
 
                # Call GPG
                $command = wfEscapeShellArg( $wgGPGCommand ) . " --batch --yes -ear " . 
-                 wfEscapeShellArg( $wgGPGRecipient ) . " -o " . wfEscapeShellArg( $output, $input );
+                 wfEscapeShellArg( $wgGPGRecipient ) . " -o " . wfEscapeShellArg( $output );
+               if ( $wgGPGHomedir ) {
+                       $command .= " --homedir " . wfEscapeShellArg( $wgGPGHomedir );
+               } 
+               $command .= " " . wfEscapeShellArg( $input );
 
                shell_exec( $command );
 
@@ -206,8 +210,8 @@ class BoardVoteForm {
                $result = file_get_contents( $output );
 
                # Delete temporary files
-               #unlink( $input );
-               #unlink( $output );
+               unlink( $input );
+               unlink( $output );
                
                return $result;
        }