]> mj.ucw.cz Git - gallery.git/blob - example/gallery.cgi
Added an example web front-end
[gallery.git] / example / gallery.cgi
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use lib $ENV{'DOCUMENT_ROOT'} . "/../lib/gal/lib";
7 use lib $ENV{'DOCUMENT_ROOT'} . "/../lib/perl";
8 use UCW::CGI;
9 use UCW::CGI::ErrorHandler;
10 use UCW::Gallery;
11 use UCW::Gallery::Web::HighSlide;
12
13 my $dir;
14 UCW::CGI::parse_args({
15         dir => { var => \$dir, check => '^\w+(/([A-Za-z0-9][A-Za-z0-9.-]*))*$' },
16 });
17
18 my $path = $ENV{'DOCUMENT_ROOT'} . "/../lib/photos/$dir";
19 if ($dir ne "" && -f "$path/gallery.cf") {
20         chdir $path or die;
21         my $gal = UCW::Gallery->load_config();
22         UCW::Gallery::Web::HighSlide->run($gal);
23 } else {
24         print STDERR "Gallery not found: $path\n";
25         UCW::CGI::http_error("404 Gallery Not Found");
26 }