Perl 
Mongers
#!/usr/bin/perl ########################################################## # CGInews 12/April/2004 # © 1999-2004 EZscripting.co.uk # Script by Alexandre Golovkine ########################################################## # Instructions: http://www.EZscripting.co.uk/cginews/ # FAQ: http://www.EZscripting.co.uk/faq/ # Help Forum: http://www.EZscripting.co.uk/helpforum/ ########################################################## my $script_name = 'http://yerevan.pm.org/cginews.pl'; my $databasefile = "/opt/apache/gocho.pm.org/80/htdocs/pm.org/yerevan/news.txt"; my $image_dir = "/opt/apache/gocho.pm.org/80/htdocs/pm.org/yerevan/images/"; my $image_url = "http://yerevan.pm.org/images"; my $html_template = "/opt/apache/gocho.pm.org/80/htdocs/pm.org/yerevan/headline.htm"; my $record_template = "/opt/apache/gocho.pm.org/80/htdocs/pm.org/yerevan/news.htm"; my $select_image = 1; my $hspace = 9; my $vspace = 2; my $news_up = 1; ########################################################## # EZscripting.co.uk © 1999 - 2004 Copyright Darren Deans # The scripts are available for private and commercial use. # You can use the scripts in any website you build. # It is prohibited to sell the scripts in any format to anybody. # The scripts may only be distributed by EZscripting.co.uk # The redistribution of modified versions of the scripts is prohibited. # EZscripting.co.uk accepts no responsibility or liability # whatsoever for any damages however caused when using our services or scripts. # By downloading and using this script you agree to the terms and conditions. ########################################################## use CGI qw/:standard/; $FORM{mode}=param('mode'); $FORM{record}=param('record'); $FORM{login}=param('login'); $FORM{password}=param('password'); $FORM{action}=param('action'); $FORM{new_field}=param('new_name'); $FORM{action}="default" if !$FORM{action}; $FORM{headlines} = param('headlines'); $page=param('page')+1; $default_mode=1 if param('mode') eq 'shtml'; print "Content-type: text/html\n\n"; create_db() unless -f $databasefile; my $txt; %SUB = ( default=> \&default, main => \&main, add => \&add, save => \&save, delete => \&delete, update => \&update, view => \&view, show => \&show ); $SUB{$FORM{action}}->(); html_text($txt); exit; ########################################################## sub read_file{ open(F, $_[0]) || error("Can't open file $_[0]!"); my @data = ; close F; return @data; } sub read_base{ my @content; my @data = read_file("$databasefile"); chomp $data[0]; @field_name=split('\|',$data[0]); my $p=0; foreach(@field_name){$show_position=$p if $_ eq 'show'; $p++;} error('Bad database file') if @field_name<1; my $b=0; for(1..@data-1){ chomp $data[$_]; @line=split('\|',$data[$_]); my $a=0; if($_[0] == 1){ if($line[$show_position] eq 'Yes'){ $content->[$b]->{'record'} = $_; foreach $name (@field_name){$content->[$b]->{$name} = $line[$a++];} $b++; } #$content->[$b]->{'record'} = $_; #foreach $name (@field_name){$content->[$b]->{$name} = $line[$a++];} } else{ $content->[$_]->{'record'} = $_; foreach $name (@field_name){$content->[$_]->{$name} = $line[$a++];} } } return $content; } sub get_record{ my $text = $_[0]; $text =~ s{<<(.*?)>>}{exists($INSERT{$1}) ? $INSERT{$1} : ""}gsex; return $text; } sub get_html{ my @txt = read_file($_[0]); foreach(@txt){$txt.=$_;} $txt=~/(.*)