/usr/share/rtpg-www/htdocs/index.cgi is in rtpg-www 0.2.11-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | #!/usr/bin/perl
=head1 NAME
index.cgi - controller script
=head1 DEBUG
For debug use addresses with debug parameter. For example:
http://my_page/index.cgi?show=list&debug=1
etc.
then you can see all variables for templates.
=head1 AUTHORS
Copyright (C) 2008 Dmitry E. Oboukhov <unera@debian.org>,
Copyright (C) 2008 Roman V. Nikolaev <rshadow@rambler.ru>
=head1 LICENSE
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
=cut
use warnings;
use strict;
use utf8;
use open qw(:std :utf8);
use CGI::Carp qw(fatalsToBrowser);
use File::Basename;
use File::Spec;
our $VERSION = "0.2.11";
our $PROJECT_NAME = "rtpg";
use lib qw(../lib);
use RTPG::WWW::Config;
use RTPG::WWW::Template;
use RTPG::WWW::Locale;
use RTPG;
# Get params ###################################################################
my %params = (version => $VERSION);
$params{show} = cfg->get('show') || 'index';
# Load module and get data #####################################################
my $module = 'RTPG::WWW::Frame::' . ucfirst lc $params{show};
eval "require $module";
if( $@ )
{
$params{show} = 'error';
$params{error} = { message => $@, status => 503 };
}
$params{data} = $module->new;
if( $params{data}{error} )
{
$params{show} = 'error';
$params{error} = { message => $params{data}{error}, status => 503 };
}
# If debug option aviable die with params ######################################
DieDumper \%params if cfg->get('debug');
# IF some actions then redirect ################################################
# Files for this page ##########################################################
for (qw(current default))
{
if( -f cfg->{dir}{skin}{$_} .'/'. $params{show} .'.css' )
{
push @{ cfg->{url}{skin}{css} },
cfg->{url}{skin}{$_} .'/'. $params{show} .'.css';
last;
}
}
for (qw(current default))
{
if( -f cfg->{dir}{skin}{$_} .'/'. $params{show} .'.js' )
{
push @{ cfg->{url}{skin}{js} },
cfg->{url}{skin}{$_} .'/'. $params{show} .'.js';
last;
}
}
# For some frame type add some resources
if( $params{show} eq 'panel' )
{
push @{ cfg->{url}{skin}{js} }, 'index.cgi?show=string&';
}
elsif( $params{show} eq 'prop' )
{
for (qw(current default))
{
if( -f cfg->{dir}{skin}{$_} .'/prop.'. $params{data}{prop} .'.css' )
{
push @{ cfg->{url}{skin}{css} },
cfg->{url}{skin}{$_} .'/prop.'. $params{data}{prop} .'.css';
last;
}
}
for (qw(current default))
{
if( -f cfg->{dir}{skin}{$_} .'/prop.'. $params{data}{prop} .'.js' )
{
push @{ cfg->{url}{skin}{js} },
cfg->{url}{skin}{$_} .'/prop.'. $params{data}{prop} .'.js';
last;
}
}
push @{ cfg->{url}{skin}{js} }, 'js/jquery.treetable.min.js';
}
elsif( $params{show} eq 'list' )
{
push @{ cfg->{url}{skin}{js} }, 'js/jquery.tablesorter.min.js';
}
# Output #######################################################################
my ($template, $file);
# Output for js strings
if($params{show} eq 'string')
{
$template = RTPG::WWW::Template->new(WRAPPER => undef);
$file = $params{show} . '.tt.js';
}
# Output for html
else
{
$template = RTPG::WWW::Template->new;
$file = $params{show} . '.tt.html';
}
$template->process( $file, \%params );
|