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