#!/usr/local/bin/perl # $Id: default.cgi,v 1.6 2003/08/07 04:35:43 erik Exp $ use strict; use warnings; use Data::Dumper; use lib '.'; use ELJ; my %methods = ( 'Do Nothing' => \&doNothing, 'Friends Only' => \&FriendsOnly, 'Friends Only Plus' => \&FriendsOnlyPlus, 'Friends Custom Security' => \&CustomSecurity, 'Private' => \&allPrivate, 'Public' => \&allPublic, 'Unmarked Secure Posts' => \&FindUnmarked, 'List Picture Keywords' => \&PictureKeywords ); ELJ::MainLoop(%methods,"http://www.valdemar.net/~erik/lj/scripts/default.cgi"); sub doNothing (\%$) { # very trivial example, does nothing to an entry my %post = %{(shift)}; print "
\n", Dumper(\%post), "\n\n"; return 0; }; sub FriendsOnly (\%$) { # sets all posts that aren't private or with a custom group mask to friends only my %post = %{(shift)}; if(defined($post{"security"})) { # not public # leave private entries alone return 0 if($post{"security"} eq 'private'); # leave custom, friendsonly, and weird allowmasks alone return 0 if($post{"allowmask"} >= 0); } $post{"security"} = "usemask"; $post{"allowmask"} = 1; ELJ::EditEvent(%post); print "...changed to friends only\n"; return 0; } sub FriendsOnlyPlus (\%$) { # adds "(group friends only)" to the first line of the event when changing my %post = %{(shift)}; $post{"event"} = "%28group+friends+only%29%0A%0A" . $post{"event"}; # predicated on unchanged FriendsOnly subroutine above so event won't # really change unless the security is changed return FriendsOnly(%post,@_); } sub CustomSecurity (\%$) { # sets all posts that aren't private or with a custom group mask to friends only my %post = %{(shift)}; my $option = shift; my $allowmask; if ($option eq "") { print "