- my $hostDestSel;
- foreach my $h ( GetUserHosts() ) {
- my $sel = " selected" if ( $h eq $In{host} );
- $hostDestSel .= "<option value=\"$h\"$sel>${EscHTML($h)}</option>";
+ my($hostDestSel, @hosts, $gotThisHost, $directHost);
+
+ #
+ # Check all the hosts this user has permissions for
+ # and make sure direct restore is enabled.
+ # Note: after this loop we have the config for the
+ # last host in @hosts, not the original $In{host}!!
+ #
+ $directHost = $host;
+ foreach my $h ( GetUserHosts(1) ) {
+ #
+ # Pick up the host's config file
+ #
+ $bpc->ConfigRead($h);
+ %Conf = $bpc->Conf();
+ if ( BackupPC::Xfer::restoreEnabled( \%Conf ) ) {
+ #
+ # Direct restore is enabled
+ #
+ push(@hosts, $h);
+ $gotThisHost = 1 if ( $h eq $host );
+ }