#!/usr/bin/perl # # Parishcouncil.net / Parish Websites Ltd © 2008 # ##################################################################################### # Options & Settings my $scriptname = 'gallery.pl'; my $database = 'gallery.csv'; my $token = '@#@#@'; my $image_dir = '../gallery/images'; my $template_list = '../gallery/gallery_view.php'; my $template_view = '../gallery/viewtemplate.html'; my $template_slide = '../gallery/slide_view.php'; my $template_admin = '../gallery/admin_view.php'; my $template_error = '../gallery/template.html'; my $image_url = '../gallery/images'; # Admin Setting & Options my $maxfilesize = 400000; my $login = 'djalsjdasdos90d09730947203'; my $password = 'aslhdoiahsdoasdh9001273'; # Look & Feel Options my $thumbsperpage = 100; my $thumbsperrow = 100; my $thumbsperadminpage = 6; my $viewtarget = "_new"; my $slidetarget = "_new"; my $tablebackground = "#F5EAE8"; my $dateformat = "EU"; # otherwise, set to "US" my $server_timezone_offset = 0; my $slideselectorcolour = "#BFDCB3"; my $entryselectorcolour = "#BFDCB3"; my $slidetime = 7; my $persistentslideselector = 0; # thumbnail default size my $thumb_x_pxsize = '150'; my $thumb_y_pxsize = '150'; # default action my $default_action = 'list'; # STRING TABLE my %WORDS = ( E_TEMPLATE => "Error : template file could not be loaded", E_NOTAUTHORISED => "You seem not to be authorised to perform this action", LOGIN => "Login Name", PASSWORD => "Password", SUBMIT => "Submit", DELGALWARNING => "Warning ! Deleting a gallery will remove ALL pictures associated with it.
If you're not sure, press the back button above. Otherwise, select the gallery your want to delete and press the button below:", DELETEGALLERY => "Delete Gallery", RENAMEGALLERY => "Rename a Gallery", E_DBOPEN => "Cannot open database", GALPICK => "Show this Gallery", PREVPAGE => "previous page", NEXTPAGE => "next page", NEWENTRY => "New Entry", GALVIEW => "Normal Gallery View", EDIT => "Edit", DELETE => "Delete", REMOVEDENTRY => "Removed entry", ADDEDENTRY => "Added entry", CHANGEDENTRY => "Changed entry", WITHTITLE => "with title", BACKTOADMIN => "Back to Admin Console", E_FILETYPE => "Wrong file type", CANTSAVE => "Can't save", FILETOOBIG => "File is too big, maximum size is", UPLOADFAILED => "File upload failed", E_SAVETHUMB => "Error saving thumb file", NOTFOUND => "Erroneous request : you might have specified an ID not belonging to this gallery", NEWGALLERYNAME => "New Gallery Name", NOGALLERYSPEC => "You did not specify a gallery name", RENAMEDGALLERY => "Renamed Gallery", TITLE => "Title", DESCRIPTIVETEXT => "Descriptive Text", FILE => "File", GALLERY => "Gallery", NEWGALLERY => "New Gallery", NEWGALLERYNAME => "New Gallery Name", GENPPF => "General Purpose Field", VISIBLE => "Visible", RECREATETHUMBS => "Recreate Thumbnail Images", THUMBSREGENERATED => "Thumbnail images have been regenerated", NEEDGD => "You need GD to be installed to perform this function", REMOVED => "Removed", CREATED => "Created", INVALIDDATEFORMAT => "Invalid Date Format Specified !", TOUCHTIME => "Touch Date/Time Field", ORDERBY => "Order by", ORDER => "Order", REORDER => "Reorder Entries", ALL => "Show All Galleries", TIME => "Date/Time", DATABASEREORDERED => "The database has been reordered", APPINFO => "Application Info", NOGALLERY => "No gallery specified" ); ####### END OF OPTIONS SECTION ##################################################################################### ##################################################################################### ##################################################################################### # Startup my $use_GD; # set to 0 to fully disable use of GD my $GDinstalled; BEGIN { $GDinstalled = eval { require GD }; if ($GDinstalled != 0) { $use_GD = 1; } else {$use_GD = 0;} } use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use strict; print "Content-type: text/html\n\n"; my $template = $template_list; # Parse Request my $raction; if (defined(param('action'))) { $raction = param('action'); } else { $raction = $default_action; } my $rID = param('ID'); my $rhash = param('hash'); my $rlogin = param('login'); my $rpassword = param('password'); my $rpage = param('page'); my $rcat = param('cat'); my $rnohl = param('nohl'); my $slideset = param('slideset'); my $order_by = param("order_by"); my $order = param("order"); if (!defined($rnohl)) { $rnohl = 0;} my $hash = crypt($password,$login); my $galleries; # Read Template my $header = ""; my $footer = ""; my $tpage = ""; my $tlist = ""; sub SetTemplate { (my $temp, my $ext) = @_; if (!open(TEMPLATE, "< $temp")) { print "$WORDS{E_TEMPLATE} ($temp)"; exit(1); } my @templ =