| 
      
            Lines 46-51
          BEGIN {
      
      
        Link Here
      
     | 
  
        
          | 46 | 
                  setlanguagecookie getlanguagecookie pagination_bar parametrized_url  | 
          46 | 
                  setlanguagecookie getlanguagecookie pagination_bar parametrized_url  | 
        
        
          | 47 | 
                  output_html_with_http_headers output_ajax_with_http_headers output_with_http_headers  | 
          47 | 
                  output_html_with_http_headers output_ajax_with_http_headers output_with_http_headers  | 
        
        
          | 48 | 
                  output_and_exit_if_error output_and_exit output_error  | 
          48 | 
                  output_and_exit_if_error output_and_exit output_error  | 
        
            
               | 
               | 
              49 | 
                      redirect_if_opac_suppressed  | 
            
        
          | 49 | 
              );  | 
          50 | 
              );  | 
        
        
          | 50 | 
          }  | 
          51 | 
          }  | 
        
        
          | 51 | 
           | 
          52 | 
           | 
        
  
    | 
      
            Lines 429-435
          sub parametrized_url {
      
      
        Link Here
      
     | 
  
        
          | 429 | 
              return $ret;  | 
          430 | 
              return $ret;  | 
        
        
          | 430 | 
          }  | 
          431 | 
          }  | 
        
        
          | 431 | 
           | 
          432 | 
           | 
        
          
            
              | 432 | 
              END { }                         # module clean-up code here (global destructor) | 
              433 | 
              =item redirect_if_opac_suppressed  | 
            
            
               | 
               | 
              434 | 
               | 
            
            
              | 435 | 
                  redirect_if_opac_suppressed( $query, $biblio )  | 
            
            
              | 436 | 
                      if C4::Context->preference('OpacSuppression'); | 
            
            
              | 437 | 
               | 
            
            
              | 438 | 
              For a given I<Koha::Biblio> object, it handles redirection if it is suppressed  | 
            
            
              | 439 | 
              from the OPAC.  | 
            
            
              | 440 | 
               | 
            
            
              | 441 | 
              =cut  | 
            
            
              | 442 | 
               | 
            
            
              | 443 | 
              sub redirect_if_opac_suppressed { | 
            
            
              | 444 | 
                  my ( $query, $biblio ) = @_;  | 
            
            
              | 445 | 
               | 
            
            
              | 446 | 
                  # redirect to opac-blocked info page or 404?  | 
            
            
              | 447 | 
                  my $redirect_url;  | 
            
            
              | 448 | 
                  if ( C4::Context->preference("OpacSuppressionRedirect") ) { | 
            
            
              | 449 | 
                      $redirect_url = "/cgi-bin/koha/opac-blocked.pl";  | 
            
            
              | 450 | 
                  } else { | 
            
            
              | 451 | 
                      $redirect_url = "/cgi-bin/koha/errors/404.pl";  | 
            
            
              | 452 | 
                  }  | 
            
            
              | 453 | 
                  if ( $biblio->opac_suppressed() ) { | 
            
            
              | 454 | 
               | 
            
            
              | 455 | 
                      # if OPAC suppression by IP address  | 
            
            
              | 456 | 
                      if ( C4::Context->preference('OpacSuppressionByIPRange') ) { | 
            
            
              | 457 | 
                          my $IPAddress = $ENV{'REMOTE_ADDR'}; | 
            
            
              | 458 | 
                          my $IPRange   = C4::Context->preference('OpacSuppressionByIPRange'); | 
            
            
              | 459 | 
                          if ( $IPAddress !~ /^$IPRange/ ) { | 
            
            
              | 460 | 
                              print $query->redirect($redirect_url);  | 
            
            
              | 461 | 
                              C4::Auth::safe_exit();  | 
            
            
              | 462 | 
                          }  | 
            
            
              | 463 | 
                      } else { | 
            
            
              | 464 | 
                          print $query->redirect($redirect_url);  | 
            
            
              | 465 | 
                          C4::Auth::safe_exit();  | 
            
            
              | 466 | 
                      }  | 
            
            
              | 467 | 
                  }  | 
            
            
              | 468 | 
              }  | 
            
            
              | 469 | 
               | 
            
            
              | 470 | 
              END { }    # module clean-up code here (global destructor) | 
            
        
          | 433 | 
           | 
          471 | 
           | 
        
        
          | 434 | 
          1;  | 
          472 | 
          1;  | 
        
        
          | 435 | 
          __END__  | 
          473 | 
          __END__  | 
        
            
              | 436 | 
              -   | 
               | 
               |