#!/usr/bin/perl # ----------------------------------------------------------------------------- # Auto Manager v2.30 # Copyright (C) 1998-2003 interactivetools.com Inc. All Rights Reserved # http://www.interactivetools.com/ # ----------------------------------------------------------------------------- # This program is protected by Canadian and international copyright laws. Any # use of this program is subject to the the terms of the license agreement # included as part of this distribution archive. Any other uses are stictly # prohibited without the written permission of interactivetools.com and all other # rights are reserved. # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- # Warning : Modifying the source code violates your license agreement! # ----------------------------------------------------------------------------- $SIG{__DIE__}=$SIG{__WARN__}=\&su;my$cgifile=$0;$cgifile=~s/.*[\\\/]//;my@ar=($0,$ENV{'SCRIPT_FILENAME'}); my$cgidir=(grep(/$cgifile$/i&&s/^(.*)[\\\/].*/$1/,@ar))[0];$cgidir||=(($^O=~/mswin/i?`cd`:`pwd`)=~/(.*)/)[0]; $cgidir=~s/\\/\//g;if(!$cgidir){die("Can't determine cgi directory!\n")}%he=("progVer"=>"2.30","progRel"=>"June 25th,1999","progUpd"=>"June 4,2003","perlOS"=>$^O||"Unknown","perlVer"=>$]||"Unknown","cgidir"=>$cgidir,"cgiurl"=>(split("/",$ENV{'SCRIPT_NAME'}))[-1],"ltime"=>time,"stime"=>time,"prod_id"=>12,"prog_build"=>'1295',"templatedir1"=>'../templates',"templatedir2"=>'../templates/interface',"debug"=>0,);%hh=('filelock'=>"$cgidir/../data/filelock.lock",'datadir'=>"$cgidir/../data",); use Fcntl qw(:DEFAULT :flock);for(0..9){push(@al,"limage$_")}for(1..75){push(@al,"lfield$_")} for(0..9){push(@an,"himage$_")}for(1..50){push(@an,"hfield$_")}for(1..50){push(@af,"lfield$_"."_name"); push(@af,"lfield$_"."_type");push(@af,"lfield$_"."_active")}for(51..75){push(@ak,"lfield$_"."_name"); push(@ak,"lfield$_"."_type");push(@ak,"lfield$_"."_active")}for(1..50){push(@af,"hfield$_"."_name"); push(@af,"hfield$_"."_type");push(@af,"hfield$_"."_active")}%hi=("datafile"=>"listing.dat","filelock"=>"filelock.lock","fields"=>[qw(num owner created updated),@al,hidden],"backup"=>"disabled","cgiext"=>".cgi");%hj=("datafile"=>"user.dat","filelock"=>"filelock.lock","fields"=>[qw(num name login_id login_pw access created_mon created_day created_year expires_mon expires_day expires_year expires_date expires_never disabled listings_max listings_unlimited user_listed specify_filename homepage_filename notes),@an,listings_hidden],"backup"=>"disabled","cgiext"=>".cgi");%hl=("datafile"=>"setup.dat","filelock"=>"filelock.lock","fields"=>["num",@af,qw(company_name domain_name product_id publish_listing_index publish_homepage_index publish_listing_image0 publish_homepage_image0 upload_maxk login_timeout listing_perpage homepage_perpage userman_perpage db_sorting titlebar footerbar logoff_url image_url listing_dir listing_url homepage_dir homepage_url search_url time_adjh time_adj_hour time_adjm time_adj_min installed),@ak,qw(d prog_ver max_filelock_duration c demo branding publish_ext thumbnail_create thumbnail_width thumbnail_height)],"backup"=>"disabled","cgiext"=>".cgi");%ib=("datafile"=>"help.dat","filelock"=>"filelock.lock","fields"=>[qw(num parent title content)],"backup"=>"disabled","cgiext"=>".cgi");%hd=&uq;%ho=&up;{ my$datafile="$he{'cgidir'}/../data/$hl{'datafile'}$hl{'cgiext'}";if(open(FILE,"<$datafile")){ my($data_line)=grep{/^\d/};close(FILE);$hb{'max_filelock_duration'}=(split(/¡/,$data_line))[405]} if($hb{'max_filelock_duration'}<5){$hb{'max_filelock_duration'}=5}}&sk(\%hl,\%hb,1);$he{'titlebar'}=$hb{'titlebar'}; $he{'footerbar'}=$hb{'footerbar'};$he{'image_url'}=$hb{'image_url'};$he{'homepage_url'}=$hb{'homepage_url'}; $he{'listing_url'}=$hb{'listing_url'};$he{'search_url'}=$hb{'search_url'};$he{'search_homepage_url'}=$hb{'search_url'}; $he{'search_homepage_url'}=~s/search\.(\w+)$/search_homepage.$1/i;$he{'header_product'}="Auto Manager"; $he{'header_version'}=$he{'progVer'};$he{'header_company_name'}=$hb{'company_name'};$he{'header_domain_name'}=$hb{'domain_name'}; $he{'header_license_num'}=&vu($hb{'product_id'});$he{'upload_maxk'}=$hb{'upload_maxk'};$he{'publish_ext'}=$hb{'publish_ext'}||"html"; $he{'thumbnail_width'}=$hb{'thumbnail_width'};$he{'thumbnail_height'}=$hb{'thumbnail_height'}; if($hb{'time_adjh'}eq"add"){$he{'ltime'}+=(int($hb{'time_adj_hour'}*60*60))};if($hb{'time_adjh'} eq"minus"){$he{'ltime'}-=(int($hb{'time_adj_hour'}*60*60))};if($hb{'time_adjm'}eq"add"){$he{'ltime'}+=(int($hb{'time_adj_min'}*60))}; if($hb{'time_adjm'}eq"minus"){$he{'ltime'}-=(int($hb{'time_adj_min'}*60))};$hn{'mon'}=(localtime($he{'ltime'}))[4]+1; $hn{'day'}=(localtime($he{'ltime'}))[3];$hn{'year'}=(localtime($he{'ltime'}))[5]+1900;$hn{'date'}=sprintf("%04d%02d%02d",$hn{'year'},$hn{'mon'},$hn{'day'}); $|++;%hm=&tl("$he{'cgidir'}/config.ini");umask oct($hm{'umask'})if$hm{'umask'};if($hm{'thumbnailing'}{'disable_thumbnails'}){ $hb{'thumbnail_create'}=0;&sn(\%hl,\%hb,1)}sub tl{local(*FILE);my($file)=$_[0];my(@ah,$ref,%hk); $ref=\%hk;if(!$_[0]){die"INI_Load : No ini file was specified!\n"}if(!-e $_[0]){return %hk=()} open(FILE,"<$file")||die("INI_Load : Could open ini file! $!\n");@ah=;close(FILE);foreach(@ah){/^\s*#/m&&next; if(/^\s*\[/m){$ref=\%hk;foreach(/\[(.+?)\]/g){$ref=\%{$ref->{$_}}}next}my$pos=index($_,'='); if($pos>0){my$name=substr($_,0,$pos);my$value=substr($_,$pos+1);foreach($name,$value){s/^\s+//; s/\s+$//}$name=~/[^\w]/&&die("INI_Load : Invalid key '$name' in ini file '$file'!\n"); defined $ref->{$name}&&die("INI_Load : Key '$name' defined twice in ini file '$file'!\n"); $ref->{$name}=$value}elsif($pos==-1){my$name=$_;for($name){s/^\s+//; s/\s+$//}if(!length $name){ next}defined $ref->{$name}&&die("INI_Load : Key '$name' defined twice in ini file '$file'!\n"); $ref->{$name}=1}}return %hk}sub vu{my($w,$x,$y,$z)=split(/-/,shift);my($v)=$w+join("",unpack("C3",$x))+$z; while(length $v>7){$v>>=1}if(!($w%47)&&$w/20.68==(5*20)&&$x=~/^[A-Z]{3}$/&&!($z%47)&&$y==$v){ if($x eq"\x43\x47\x57"){return(($z/47)+6000)}elsif($x eq"\x55\x50\x47"){return(($z/47)+8000)} elsif($x eq"\x45\x44\x49"){return(($z/47))}else{return(0)}}else{return(0)}}if(!$hb{'installed'}){ print"Content-type: text/html\n\n" unless($ContentType++);print&vh('_install_rm.html',\%ha); exit}my($script_filename)=$0;$script_filename=~s/.*[\/\\]//;if(("3247:2855555555555555555555555555","7863082")- &wb([$script_filename],[])){ print"Content-type: text/html\n\n" unless($ContentType++);print&vh("\x5F\x70\x72\x6F\x67\x72\x61\x6D\x5F\x63\x6F\x72\x72\x75\x70\x74\x65\x64\x2E\x68\x74\x6D\x6C",{}); exit}&vz();my($cgidir2);($cgidir2=lc$cgidir)=~s/[^a-z0-9]//g;if($hb{'c'}!=unpack '%32C*',pack 'u',$cgidir2){ $hb{'c'}=unpack '%32C*',pack 'u',$cgidir2;&sn(\%hl,\%hb,1);&vx()}if($ENV{'QUERY_STRING'}eq"r"){&vx()} if($hb{'d'}){print"Content-type: text/html\n\n" unless($ContentType++);print&vh("\x5F\x6C\x69\x63\x65\x6E\x73\x65\x5F\x64\x69\x73\x61\x62\x6C\x65\x64\x2E\x68\x74\x6D\x6C",{}); exit}if($hd{'help'}){&sv}if($hd{'help_index'}){&sw}&sb;if($hd{'login_about'}){&ug}if($hd{'logoff'}){&uh} &uf;if($hd{'listing_add'}){&tn}if($hd{'listing_edit'}){&tp}if($hd{'listing_confirm_erase'}){&to} if($hd{'listing_erase'}){&tq}if($hd{'listing_save'}){&ue}if($hd{'listing_list'}){&ua}if($hd{'listing_listall'}){&ua} if($hd{'listing_iview'}){&ty}if($hd{'listing_iviewall'}){&tz}if($hd{'listing_iedit'}){&ts} if($hd{'listing_iedit_save'}){&tt}if($hd{'listing_iconfirm_erase'}){&tr}if($hd{'listing_ierase'}){&tu} if($hd{'listing_iupload_step1'}){&tw}if($hd{'listing_iupload_step2'}){&tx}if($hd{'listing_iupload_save'}){&tv} if($hd{'homepage_edit'}){&sx}if($hd{'homepage_save'}){&tk}if($hd{'homepage_list'}){&th}if($hd{'homepage_listall'}){&th} if($hd{'homepage_iview'}){&tf}if($hd{'homepage_iviewall'}){&tg}if($hd{'homepage_iedit'}){&sz} if($hd{'homepage_iedit_save'}){&ta}if($hd{'homepage_iconfirm_erase'}){&sy}if($hd{'homepage_ierase'}){&tb} if($hd{'homepage_iupload_step1'}){&td}if($hd{'homepage_iupload_step2'}){&te}if($hd{'homepage_iupload_save'}){&tc} if($hd{'userman_add'}){&vo}if($hd{'userman_edit'}){&vq}if($hd{'userman_confirm_erase'}){&vp} if($hd{'userman_erase'}){&vr}if($hd{'userman_save'}){&vt}if($hd{'userman_list'}){&vs}if($hd{'userman_listall'}){&vs} if($hd{'setup_options_edit'}){&va}if($hd{'setup_options_save'}){&vb}if($hd{'setup_lfields_edit'}){&ux} if($hd{'setup_lfields_confirm_reset'}){&uw}if($hd{'setup_lfields_reset'}){&uy}if($hd{'setup_lfields_save'}){&uz} if($hd{'setup_hfields_edit'}){&ut}if($hd{'setup_hfields_confirm_reset'}){&us}if($hd{'setup_hfields_reset'}){&uu} if($hd{'setup_hfields_save'}){&uv}if($hd{'setup_publish_listings'}){&vf}if($hd{'setup_publish_listing_index'}){&ve} if($hd{'setup_publish_homepages'}){&vd}if($hd{'setup_publish_homepage_index'}){&vc}if($hd{'setup_recreate_thumbnails'}){&vg} &sa;exit;sub wc{my@ah=@_;if(!$he{'debug'}){return};my$line;foreach$line(@ah){$he{'debug_lines'}.=$line."
\n"}} sub sv{$num=int$hd{'help'};&sk(\%ib,\%hq,$num)||&sw;print"Content-type: text/html\n\n";print&vh("_help.html",\%hq); ℘exit}sub sw{&vh("_help.html");$rowcode=sub{$hr{$hq{'num'}}=$hq{'parent'}||0;$hw{$hq{'num'}}=$hq{'title'}; $ij{$hq{'num'}}=$hq{'content'}};&sh(\%ib,$rowcode,undef,\%hq);foreach$a(sort{$a<=>$b} keys %hr){ if($hr{$a}==0){$content.=qq|

$hw{$a}
\n|;foreach$b(sort{ $a<=>$b} keys %hr){if($hr{$b}==$a){$num=$b;$title=$hw{$num};$content.=&vi('row1');foreach$c(sort{ $a<=>$b} keys %hr){$num=$c;$title=$hw{$num};if($hr{$c}==$b){$content.=&vi('row2')}}}}}}print"Content-type: text/html\n\n"; print&vh("_help.html");℘exit}sub sb{if(!$hb{&ui('cHJvZHVjdF9pZA==')}||!&vu($hb{&ui('cHJvZHVjdF9pZA==')})){ print"Content-type: text/html\n\n" unless($ContentType++);print&vh(&ui('X2luc3RhbGxfcm0uaHRtbA=='),\%ha); exit}}sub uf{&vh("_rm_login.html");$id=lc$hd{'id'}||lc$ho{'id'};$pw=lc$hd{'pw'}||lc$ho{'pw'}; $rowcode=sub{$hs{(lc$hc{'login_id'})}=lc$hc{'login_pw'};$ih{(lc$hc{'login_id'})}=$hc{'num'}}; &sh(\%hj,$rowcode,undef,\%hc);if(!$hd{'login'}&&(!$id||!$pw)&&$ENV{'CONTENT_LENGTH'}){$error=&vi("session_expired")} elsif(!$hd{'login'}&&(!$id||!$pw)&&$ENV{'QUERY_STRING'}){$error=&vi("session_expired")}elsif(defined $hd{'id'} &&!$hd{'id'}){$error=&vi("no_username")}elsif(defined $hd{'pw'}&&!$hd{'pw'}){$error=&vi("no_password")} elsif($id&&!$hs{$id}){$error=&vi("invalid_username")}elsif($pw&&$pw ne$hs{$id}){$error=&vi("invalid_password")} if($hs{$id}&&$pw eq$hs{$id}){&sk(\%hj,\%hc,$ih{$id});if($hc{'disabled'}){$error=&vi("disabled")} if($hc{'access'}<2){$error=&vi("newuser")}elsif($hc{'expires_date'}<=$hn{'date'}&&!$hc{'expires_never'}){ $error=&vi("expired")}}if(!$error&&$hs{$id}&&$pw eq$hs{$id}){$expires=time+(($hb{'login_timeout'}|1)*60); &ur('id',$id,$expires);&ur('pw',$pw,$expires);%hf=%hc;return}if($error){$he{'footerbar'}=$error} print"Content-type: text/html\n\n" unless($ContentType++);print&vh("_rm_login.html");℘exit} sub ug{$ha{'company_name'}=$hb{'company_name'};$ha{'domain_name'}=$hb{'domain_name'};$ha{'license_num'}=&vu($hb{'product_id'}); print"Content-type: text/html\n\n";print&vh("_rm_login_about.html",\%ha);℘exit}sub uh{&ur('id',""); &ur('pw',"");&ur('listing_keyword',"");if($hb{'logoff_url'}){print"Content-type: text/html\n\n"; print qq||;print qq||; print qq||;exit}else{print"Content-type: text/html\n\n" unless($ContentType++); print&vh("_rm_login.html");℘exit}}sub sa{&sq(4);&vh("_rm_about.html");$ha{'name'}=$hf{'name'}; $ha{'access'}=&vi("access$hf{'access'}");$ha{'created'}=&vi("mon$hf{'created_mon'}");$ha{'created'}.=sprintf(" %02d,",$hf{'created_day'}); $ha{'created'}.=$hf{'created_year'};if($hf{'expires_never'}){$ha{'expires'}=&vi('never')}else{ $ha{'expires'}=&vi("mon$hf{'expires_mon'}");$ha{'expires'}.=sprintf(" %02d,",$hf{'expires_day'}); $ha{'expires'}.=$hf{'expires_year'}}if($hf{'listings_hidden'}){$ha{'publish'}=&vi("disallow")} else{$ha{'publish'}=&vi("allow")}if($hf{'listings_unlimited'}){$ha{'listings'}=&vi("unlimited")} else{$ha{'listings'}=int$hf{'listings_max'}}if($hf{'user_listed'}){$ha{'displayed'}=&vi("yes")} else{$ha{'displayed'}=&vi("no")}if($hf{'specify_filename'}&&$hf{'homepage_filename'}){$hp_file=$hf{'homepage_filename'}} else{$hp_file=sprintf("h%04d.".$he{'publish_ext'},$hf{'num'})}$ha{'homepage'}="$hb{'homepage_url'}/$hp_file"; &sr("_rm_about.html",\%ha)}sub sq{local($hnum)=int($_[0]);print"Content-type: text/html\n\n" unless($ContentType++); unless($ContentHeader++){if($hf{'access'}==4){print&vh("_ui_superuser.html")}elsif($hf{'access'}==3){ print&vh("_ui_admin.html")}elsif($hf{'access'}==2){print&vh("_ui_regular.html")}else{print&vh("_ui_disabled.html")}} &wp}sub sr{local($file)=$_[0];local($out)=$_[1];unless($file){die("Display_Page : No template file was specified!\n")} print"Content-type: text/html\n\n" unless($ContentType++);unless($ContentHeader++){if($hf{'access'}==4){ print&vh("_ui_superuser.html")}elsif($hf{'access'}==3){print&vh("_ui_admin.html")}elsif($hf{'access'}==2){ print&vh("_ui_regular.html")}else{print&vh("_ui_disabled.html")}}$ha{'content'}=&vh($file,$out); &vh("_ui_buttons.html");$ha{'buttons'}=&vi("$file.buttons");$ha{'cuser_name'}="$hf{'name'}"; unless($ContentBody++){print&vi("pagebody",\%ha)}℘if($he{'debug'}){print"

Debug output

\n"; print$he{'debug_lines'}}exit}sub su{print"Content-type: text/html\n\n" unless($ContentType++); foreach(@_){$ha{'error'}.="$_ "}print$ha{'error'};if($he{'debug'}){print"

Debug output

\n"; print$he{'debug_lines'}}exit}sub wa{unless($hb{'branding'}){return}my$content=shift;my$time=scalar(localtime()); my$gen='';$$content=''."\n\n".$$content; unless($$content=~s/(]+>)/$gen\n$1/is){$$content=~s/(]*>)/$1\n$gen\n/i}}sub wp{ print''."\n"}sub ua{my($bypass_cookies)=(@_); $pagenum=$hd{'pagenum'}||$ho{'listing_pagenum'}||1;$perpage=int$hb{'listing_perpage'}||10; $search=$hd{'search'}||$ho{'listing_search'};if(defined $hd{'keyword'}){$keyword=$hd{'keyword'}} else{$keyword=$ho{'listing_keyword'}}if($hd{'listing_listall'}){$search=""; $keyword=""}if(defined $hd{'keyword'}||$hd{'listing_listall'}){ $pagenum=1}if(!$bypass_cookies){&ur("listing_search",$search);&ur("listing_keyword",$keyword); &ur("listing_pagenum",$pagenum)}local(%hz,%hu);$rowcode=sub{$hz{$hc{'num'}}=$hc{'name'};$hu{ $hc{'num'}}=$hc{'listings_hidden'}};&sh(\%hj,$rowcode,undef,\%hc);for$fnum(1..75){if($hb{"lfield$fnum"."_active"}){ $fname=$hb{"lfield$fnum"."_name"};if($fname=~m/^(.*?)\((.*?)\)$/i){$fname=$1}if($search eq$fnum){ $ha{'search_options'}.=qq|