#!/usr/local/bin/perl
use CGI qw(:standard);
use CGI::Cookie;
$ad_style = param('ad_style') || "white" ; # ad_style =["white"|"black"]
if ( $ad_style eq "white" ) { $ad_style_white = "checked" ; } else { $ad_style_black = "checked"; }
$author_name = param('author_name') || "" ;
$author_email = param('author_email') || "" ;
$author_url = param('author_url') || "" ;
$sig_string = param('sig_string') || "" ;
$tag_string = param('tag_string') || "undesign.org" ;
$sig_string =~ s/\"/\'/g ;
if ( $sig_string ne "" )
{
@sig_string2 = split(/\n/,$sig_string) ;
for ($i = 0 ; $i <= $#sig_string2 ; $i++ )
{
$sig_string2[$i] =~ s/\n// ;
$sig_string2[$i] =~ s/\r// ;
$sig_string2[$i] =~ s/'/\\'/g;
$sig_string2[$i] =~ s/^/'/ ;
$sig_string2[$i] =~ s/$/' + "\\n" + / ;
}
}
$tag_string =~ s/\"/\"\;/g ;
$author_name =~ s/\"/\"\;/g ;
if ($author_url ne "" && !($author_url =~ m/^http:\/\//) ) { $author_url =~ s/^/http:\/\// ; }
# variables set by is.cgi to indicate text too long
$whoops = param('whoops') || "" ;
$whoops2 = param('whoops2') || "" ;
if ( $whoops eq "true" )
{
$whoops_text = 'Whoops! Due to the global pixel crisis caused by the' ;
$whoops_text = $whoops_text . ' .com (!!) crash,' ;
$whoops_text = $whoops_text . ' we ask you to limit your unslogan to 3 lines and 108 characters. Thank you' ;
$whoops_text = $whoops_text . ' for your understanding.
' ;
}
if ( $whoops2 eq "true" )
{
$whoops_text = 'Hmmm ... we really must stress the importance of conserving pixels!' ;
$whoops_text = $whoops_text . ' We ask you to limit your unslogan to 3 lines and 108 characters. Thank you once again' ;
$whoops_text = $whoops_text . ' for your understanding.
' ;
}
%cookies = fetch CGI::Cookie;
@jar = (exists($cookies{'user'})) ? $cookies{'user'}->value : ();
if (($jar[0] ne "") && (($author_name eq "") || ($author_name eq "Anonymous")) ) { $author_name = $jar[0] ; }
if (($jar[1] ne "") && (($author_email eq "") || ($author_email eq 'nobody@undesign.org')) ) { $author_email = $jar[1] ; }
if (($jar[2] ne "") && ($author_url eq "")) { $author_url = $jar[2] ; }
if ($author_name eq "" ) { $author_name = "Anonymous" ; }
if ($author_email eq "" ) { $author_email = 'nobody@undesign.org' ; }
if (exists($cookies{'user'})) {
$personal_directory = <<"_____EoI2_____";
_____EoI2_____
}
$stock_view = param('stock_view') || "" ; # default: start with photos 1 through 9
$ad_left = param('ad_left') || param('ad_left_carry') || "" ; # default: nothing selected
if ( ( $ad_left ne "") && ($stock_view eq "") )
{
$ad_number = $ad_left ;
$ad_number =~ s/[^0-9]//g ;
$ad_number =~ s/^0+//g ;
if ( $ad_number <= 12 ) {
$stock_view = "1" ;
} else {
$stock_view = (int(($ad_number-1)/12)*12) + 1 ;
}
}
if ( $stock_view eq "" ) { $stock_view = "1" ; }
# create an array with ads numbered one through ....
# then assign particular source ads to the list of 9 that are there
# determine if one is checked by looking through the array (display the appropriate list)
# create the side links based on the one that is checked
opendir (STOCK_LIST, "./istock") ;
@stock_list = grep(!/^\.\.?$/, readdir(STOCK_LIST)) ;
# pay attention: add a dummy element to front of array so file names match array subscript
unshift(@stock_list,"aa");
closedir (STOCK_LIST) ;
@stock_checked[0,$#stock_list] = "" ;
if ( $ad_left ne "" ) {
# extract the number
$ad_array = substr( $ad_left, 0, 3 );
$stock_checked[$ad_array] = "checked" ;
if ( (($stock_view eq 1) && ($ad_array <= 12 ))
|| (($stock_view gt 1) && ( $ad_array <= $stock_view + 12)
&& ($ad_array >= $stock_view)))
{
$onload = "onLoad=\'swap_image(" . '"' . $ad_left . '","' ;
if ($stock_view eq 1 )
{ $the_num = $ad_array ; }
else { $the_num = $ad_array - $stock_view + 1 ; }
$onload = $onload . sprintf("%d",$the_num) . '","image' . sprintf("%02d",$the_num) ;
$onload = $onload . '")' . "\'" ;
}
}
# now create the navigation list for other photos
# format of links: Photos 013 - 024
# we assume database is in multiples of 12 ... sorry
$boilerplate = '
Select a photo from the collection, enter a pithy unslogan, create your UNADand voilà!you're in orbit. At a loss for words? Never fear!
Look to Tibor for inspiration.
Navigate through the collection using the links below.