From 555e75a89748fdf5e41c4f10dd0c8395396d8acb Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sun, 9 May 2004 06:03:54 +0000 Subject: [PATCH] bug fixes --- includes/DefaultSettings.php | 2 +- includes/SpecialBoardvote.php | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 1490f9f529..8c6f07c0aa 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -375,5 +375,5 @@ $wgContributingCandidates = array(); $wgVolunteerCandidates = array(); $wgGPGCommand = "gpg"; $wgGPGRecipient = "boardvote"; - +$wgGPGHomedir = false; ?> diff --git a/includes/SpecialBoardvote.php b/includes/SpecialBoardvote.php index 1555eb4363..2984bd515e 100644 --- a/includes/SpecialBoardvote.php +++ b/includes/SpecialBoardvote.php @@ -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; } -- 2.20.1