{
     my $status = $groupoffice{'status'} || "disabled";
     return "    # groupoffice is disabled in this VirtualHost"
            unless $status eq 'enabled';

   $OUT = "";
    my $allow = 'all';
    my $pass = '0';
    my $satisfy = 'all';
    my $name = $groupoffice{'Name'} || 'GroupOffice GroupWare';
    
    for ('exit-if-none')
    {
      if ($groupoffice{'PublicAccess'})
      {
          if ($groupoffice{'PublicAccess'} eq 'none')
          {
           next;
          }
          elsif ($groupoffice{'PublicAccess'} eq 'local')
          {
            $allow   = $localAccess;
            $pass    = 0;
            $satisfy = 'all';
          }
          elsif ($groupoffice{'PublicAccess'} eq 'local-pw')
          {
            $allow   = $localAccess;
            $pass    = 1;
            $satisfy = 'all';
          }
          elsif ($groupoffice{'PublicAccess'} eq 'global')
          {
            $allow   = 'all';
            $pass    = 0;
            $satisfy = 'all';
          }
          elsif ($groupoffice{'PublicAccess'} eq 'global-pw')
          {
            $allow   = 'all';
            $pass    = 1;
            $satisfy = 'all';
          }
          elsif ($groupoffice{'PublicAccess'} eq 'global-pw-remote')
          {
            $allow   = $localAccess;
            $pass    = 1;
            $satisfy = 'any';
          }
      }
      
      $OUT .= "#------------------------------------------------------------\n";
      $OUT .= "# groupoffice - $name\n";
      $OUT .= "#------------------------------------------------------------\n";
      
      {
        if (exists $groupoffice{'URL'})
        { $OUT .= "Alias  /$groupoffice{'URL'}  /opt/groupoffice/html\n"; }
      }
      
      $OUT .= "Alias  /groupoffice  /opt/groupoffice/html\n";

      $OUT .= "\n";
      $OUT .= "<Directory /opt/groupoffice/html>\n";
      {
      my $gosec = $groupoffice{'HTTPS'} || "off";
          if ($gosec eq "off")
	    { $OUT .= "   # SSLRequireSSL on\n"; }
    	  else
	    { $OUT .= "   SSLRequireSSL on\n"; }
      }
      $OUT .= "    AddType application/x-httpd-php .php .php3 .phtml\n";
      $OUT .= "    php_admin_value open_basedir /opt/groupoffice/html:/opt/groupoffice/files:/opt/groupoffice/home:/opt/groupoffice/tmp\n";
      $OUT .= "    php_admin_value eaccelerator.enable 1\n";
      $OUT .= "    php_flag  magic_quotes_gpc  on\n";      
      $OUT .= "    php_flag  track_vars        on\n";            
      $OUT .= "    Options FollowSymLinks ExecCGI\n";
      $OUT .= "    order deny,allow\n";
      $OUT .= "    deny from all\n";
      $OUT .= "    allow from $allow\n";
      $OUT .= "    php_value mysql.default_host $groupoffice{DbName}\n";
      $OUT .= "    php_value mysql.default_user $groupoffice{DbUser}\n";
      $OUT .= "    php_value mysql.default_password $groupoffice{DbPassword}\n";
      if ($pass)
      {
          $OUT .= "    AuthName \"$name\"\n";
          $OUT .= "    AuthType Basic\n";
          $OUT .= "    AuthExternal pwauth\n";
          $OUT .= "    require valid-user\n";
          $OUT .= "    Satisfy $satisfy\n";
      }
      $OUT .= "</Directory>\n";
    }
}
