| 1 | # $Id: Apache.pm,v 1.2 2002/08/30 10:19:36 joern Exp $ | ||
| 2 | |||
| 3 | package CIPP::Compile::Apache; | ||
| 4 | |||
| 5 | @ISA = qw ( CIPP::Compile::Generator ); | ||
| 6 | |||
| 7 | use strict; | ||
| 8 | use Carp; | ||
| 9 | use CIPP::Compile::Generator; | ||
| 10 | |||
| 11 | #--------------------------------------------------------------------- | ||
| 12 | # This interface must be implemented by the Generator/* modules | ||
| 13 | #--------------------------------------------------------------------- | ||
| 14 | |||
| 15 | sub generate_start_program { | ||
| 16 | } | ||
| 17 | |||
| 18 | sub generate_project_handler { | ||
| 19 | } | ||
| 20 | |||
| 21 | sub object_exists { | ||
| 22 | my $self = shift; | ||
| 23 | my %par = @_; | ||
| 24 | my ($name, $add_message_if_not) = | ||
| 25 | @par{'name','add_message_if_not'}; | ||
| 26 | |||
| 27 | 1; | ||
| 28 | } | ||
| 29 | |||
| 30 | sub determine_object_type { | ||
| 31 | my $self = shift; | ||
| 32 | my %par = @_; | ||
| 33 | my ($name) = @par{'name'}; | ||
| 34 | |||
| 35 | 1; | ||
| 36 | } | ||
| 37 | |||
| 38 | sub get_object_url { | ||
| 39 | my $self = shift; | ||
| 40 | my %par = @_; | ||
| 41 | my ($name, $add_message_if_has_no) = | ||
| 42 | @par{'name'.'add_message_if_has_no'}; | ||
| 43 | |||
| 44 | return "OBJECT_URL"; | ||
| 45 | } | ||
| 46 | |||
| 47 | sub check_object_type { | ||
| 48 | my $self = shift; | ||
| 49 | my %par = @_; | ||
| 50 | my ($name, $type, $message) = @par{'name','type','message'}; | ||
| 51 | |||
| 52 | # check existance and object type | ||
| 53 | 1; | ||
| 54 | } | ||
| 55 | |||
| 56 | #--------------------------------------------------------------------- | ||
| 57 | # These commands exist only for CIPP/Apache | ||
| 58 | #--------------------------------------------------------------------- | ||
| 59 | |||
| 60 | sub cmd_apredirect { | ||
| 61 | my $self = shift; | ||
| 62 | my %par = @_; | ||
| 63 | my ($tag, $options, $options_case, $closed) = | ||
| 64 | @par{'tag','options','options_case','closed'}; | ||
| 65 | |||
| 66 | my $RC = $self->RC_SINGLE_TAG; | ||
| 67 | |||
| 68 | $self->check_options ( | ||
| 69 | mandatory => { 'url' => 1 }, | ||
| 70 | optional => {}, | ||
| 71 | ) || return $RC; | ||
| 72 | |||
| 73 | my $url = $options->{url}; | ||
| 74 | |||
| 75 | $self->write ( | ||
| 76 | qq{undef \@CGI::QUERY_PARAM;\n}. | ||
| 77 | qq{my \$cipp_old_no_db_connect = \$CIPP_Exec::no_db_connect;\n}. | ||
| 78 | qq{\$CIPP_Exec::no_db_connect = 1;\n}. | ||
| 79 | qq{\$cipp_apache_request->internal_redirect ("$url");}. | ||
| 80 | qq{\$CIPP_Exec::no_db_connect = \$cipp_old_no_db_connect;\n} | ||
| 81 | ); | ||
| 82 | |||
| 83 | return $RC; | ||
| 84 | } | ||
| 85 | |||
| 86 | sub cmd_apgetrequest { | ||
| 87 | my $self = shift; | ||
| 88 | my %par = @_; | ||
| 89 | my ($tag, $options, $options_case, $closed) = | ||
| 90 | @par{'tag','options','options_case','closed'}; | ||
| 91 | |||
| 92 | my $RC = $self->RC_SINGLE_TAG; | ||
| 93 | |||
| 94 | $self->check_options ( | ||
| 95 | mandatory => { 'var' => 1 }, | ||
| 96 | optional => { 'my' => 1 }, | ||
| 97 | ) || return $RC; | ||
| 98 | |||
| 99 | my $var = $options->{var}; | ||
| 100 | my $my = $options->{'my'} ? 'my' : ''; | ||
| 101 | |||
| 102 | $self->write("$my $var = \$cipp_apache_request;\n"); | ||
| 103 | |||
| 104 | return $RC; | ||
| 105 | } | ||
| 106 | |||
| 107 | |||
| 108 | 1; |