+ #
+ # Build list of hosts
+ #
+ 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 );
+ }
+ }
+ $directHost = $hosts[0] if ( !$gotThisHost && @hosts );
+ foreach my $h ( @hosts ) {
+ my $sel = " selected" if ( $h eq $directHost );
+ $hostDestSel .= "<option value=\"$h\"$sel>${EscHTML($h)}</option>";
+ }
+