#!/usr/bin/perl # If platform is UNIX/Linux, correct the path above if necessary ################################################################################################### ## This software is copyright © 2006 Hibyte Software ## Use of the software indicates agreement to our Terms and Conditions ## To review the terms, please see http://www.hibyte.co.uk/software/terms.html # This software is under license. You may use it provided that this header is left intact # Users may may not resell this software, or any part of it, without the express permission of Hibyte. # # For more software by Hibyte please go to http://www.hibyte.co.uk/pages/catalogue.html ################################################################################################### $| = 1; #$db=1; ps(); $cfgfile='hijobs.cfg'; $rdata=($ENV{'PATH_TRANSLATED'})?'PATH_TRANSLATED':'SCRIPT_FILENAME'; read(STDIN, $xbuffer, $ENV{'CONTENT_LENGTH'});mih($xbuffer,'INPUT'); $details=$ENV{'QUERY_STRING'};mih($details,'PROCESS'); sub mih{my($take,$tag)=@_;local($pair,$name,$contents,@pairs);@pairs=split(/&/,$take); foreach $pair (@pairs) {($name, $contents) = split(/=/, $pair);$contents =~ tr/+/ /; $contents =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $contents=~s!\|!|!gs; $$tag{$name}=($$tag{$name}) ? $$tag{$name}.','.$contents : $contents; } } $isMac=($ENV{HTTP_USER_AGENT}=~/mac/i)?1:0; $isIE=($ENV{HTTP_USER_AGENT}=~/msie/i)?1:0; $ds=($ENV{'SERVER_SOFTWARE'}=~/microsoft/i)?"\\":"\/"; ############################################################################################ @INIT=(SERVER_ADDR,HTTP_HOST,SCRIPT_NAME,SERVER_NAME,DOCUMENT_ROOT,$rdata); foreach $init(@INIT){$$init=$ENV{$init};} $SCRIPT_NAME=~m!([A-Za-z0-9]+\.[plcgiPLCGI]+$)!; $this_prog=$1;$$rdata=~m!(.*?)$this_prog!; $my_base_loc=$1; $my_base_loc=~s!\/+!\/!g;db(my_base_loc,$my_base_loc); $siteloc=('http://'.$HTTP_HOST); db(siteloc,$siteloc); $cgiloc=('http://'.$HTTP_HOST.'/cgi-bin'); db(cgiloc,$cgiloc); $my_http=('http://'.$HTTP_HOST.$SCRIPT_NAME); db(my_http,$my_http); $tloc=($my_base_loc . 'templates'.$ds); db(tloc,$tloc); $dloc=($my_base_loc.'data'.$ds);db(dloc,$dloc); $cfgfile=($my_base_loc.$cfgfile); $| = 0; ############################################################################################# @processes=('logon','log2','pbox','pbox2','edit','add_item','witem','re','de','htip','sn','si'); $test_it=0;$gnum=0; while ($test_it < 1) { $val = $processes[$gnum]; if ($PROCESS{$val}) {$test_it=1; db("going",$val);} if ($gnum > $#processes) {$test_it=1;} $gnum++;} if ($PROCESS{$val}) {defs();&$val;} else { defs();primary(); } ############################################################################################## sub dmake { my ($dir)=@_; my($rt,$rpt,$mkd,$oldmask);$oldmask=umask(000); $rpt="Create Directory $dir
"; $mkd=mkdir($dir,0777);$rt=$!; $rpt.=($mkd==1)?"Successful":"Failure: $rt"; db("$rpt","$dir $rt"); $oldmask=umask($oldmask); } ############################################################################################## sub remend { my ($l)=@_; while($l=~/[\r\n]$/){$l=~s![\r\n]$!!g;} return $l; } ############################################################################################# sub logon {pass(); db(xinpass,$INPUT{password});logonsub();} sub log2 { pass(); log2sub(); } sub sn { search(); searchsub(); } sub si { search(); sisub(); } sub pbox(;$) {my($p)=@_; pass(); pboxsub($p); exit;} sub pbox2(;$) {my($p)=@_; pass(); pbox2sub($p);exit;} sub pass {if(!$psubgot){subfile('pass');$psubgot=1;}} sub search {if(!$ssubgot){subfile('search');$ssubgot=1;}} sub subfile {my($f)=@_;$f=($my_base_loc.'/subs/'.$f.'.sub'); @tt=use_this_file('',"$f");my $wen=file_text('tt');$#tt=-1; eval($wen); } ############################################################################################## sub defs { my($t,$te,$rnum,$def,$lx,$k,$grit,$val,$dummy,$name,$code,@grits,@vl,@tx); @st=('header','price','intro','bullets','outro','jobr','cldt','hwer','outro2','cdet'); # Default configuration - overridden by definitions in .cfg file or query string $kx='hawson'; $outpage='hijobs.html'; $pagebgcolour='FFFFFF'; $textcolour='333333'; $link='363B8D'; $vlink='363B8D'; $alink='B73B4D'; $hlink='B73B4D'; $font='Arial,Helvetica,sans-serif'; $tsize=12; $hsize=16; $ssize=11; $footer=1; $displaywidth=500; $indextype=1; $resperpage=1; $showsearch=1; $showdate=1; $itemindex=1; $sideindex=r; $curlink='Current Vancanciess'; $pageheader='HiJob Demonstration'; $indexheader='Vacncies'; $sectname='Jobs Archive'; $sbheader='Search This Section:'; if($PROCESS{'def'}){ $cfgfile=($my_base_loc.$PROCESS{'def'}.'.cfg'); $dloc=($my_base_loc.$PROCESS{'def'}.$ds);$ptag="&def=$PROCESS{'def'}"; } @vl=use_this_file('',$cfgfile); foreach $lx(@vl){chomp $lx;$lx=remend($lx);if($lx && $lx !=~/^#/){$lx=~m!([A-z0-9\-\_]+)\|(.+)!;$mn=$1;$mm=$2;$$mn=$mm;db($mn,$$mn);}} foreach $k(sort keys %PROCESS){$PROCESS{$k}.="\|1";} @grits=('sbheader|sb','curlink|cl','sectname|se','indexheader|ih','pageheader|ph','outpage|op','itemindex|ii', 'sideindex|sm','indextype|it','showsearch|ss','resperpage|rp','displaywidth|dw','showdate|sd'); foreach $grit(@grits){($name,$code)=split(/\|/,$grit); if($PROCESS{$code}){($val,$dummy)=split(/\|/,$PROCESS{$code});$$name=$val;$ptag.=qq~&$code\=$val~;}} foreach $k(sort keys %PROCESS){$PROCESS{$k}=~s!\|1$!!;} if(!(-d $dloc)){dmake($dloc);} } ############################################################################################# sub sbox { my($sbox,$style,$fstyle); $style=qq~font-family:$font;font-size:11px;color:\#$link~; $fstyle=qq~margin-top:2px;margin-bottom:2px;margin-left:2px;~; $sbox=qq~
~; if($sbheader){my $xh=($tsize+6);$sbox.=qq~ ~;} $sbox.=qq~
 $sbheader
 Keyword(s): Search type: 
\n
~; $sbox=($showsearch)?$sbox:' '; return $sbox; } ############################################################################################# sub primary { $body=get_page("$tloc$outpage"); my($out,$lad,$ye,$sa,$se,$sae,$snum,$xsnum,$moretag,$totnum,$lstyle,$hstyle,$sstyle); my($ynum,$ret,$as,$ae,$fsize,$xfsize,$xhsize,$phead,$ttop,$base,@gt,@xgt,@tt,@co,@head); @head=xhead('',$pagebgcolour,$link,$vlink,$alink,$hlink,$textcolour,$font,$tsize); my ($ttop,$base)=split(/content_here/,$body); $ttop||="$head[0]$head[3]
"; $base||="$head[4]";$ttop=~s!title\_here!$sectname!gi; $ttop=~s!\<\/head\>!$head[1]$head[2]\<\/head\>!i;print $ttop; $fsize=($tsize.'px');$xfsize=($ssize.'px');$xhzize=($hsize.'px');$phead=' '; footer(); $lstyle=qq~font-weight:bold;font-family:$font;font-size:$fsize;color:\#$textcolour;~; $llstyle=qq~font-weight:normal;font-family:$font;font-size:$fsize;color:\#$textcolour;~; $hstyle=qq~font-weight:bold;font-family:$font;font-size:$xhzize;color:\#$textcolour;~; $sstyle=qq~font-family:$font;font-size:$xfsize;color:\#$link~; $sbstyle=qq~font-family:$font;font-size:$xfsize;color:\#$textcolour~; if($pageheader){$xhsize=$tsize+6; $phead=qq~ $pageheader~; } footer(); $sbox=sbox(); my $sp=($indextype==2)?'sp=1&':''; $resperpage=($resperpage=~/all/i)?0:$resperpage; $sectname||='Latest Vacancies'; dirget($dloc); xtbits(); $toplink='Back to top'; $snum=($PROCESS{s})?$PROCESS{s}:$INPUT{s}; if($sideindex){$PROCESS{sp}||=1;} $xsnum=($snum)?$snum:0; my $moretag=moretag($snum,$sp); my $sitop=sitop(); $out.=$sitop; $out.= qq~$ts   $tr$phead~; $out.= qq~$tr ~; $menbit=menbit($snum,$xsnum,$sp); if(!$sideindex){$out.= $menbit;} $out.=$moretag; $#co=-1; if(!($indextype==2 && $snum<1 && !$PROCESS{sp})){ while($xsnum<($resperpage+$snum)){$xnum=$xsnum+1;$el=$store[$xsnum]; chomp $el;$lx=remend($lx);@tt=split(/\|/,$el); push @co,qq~$tt[0]\|$xnum~;$xsnum++; } } foreach $el(@co){ chomp $el;$lx=remend($lx);@xgt=split(/\|/,$el);if($xgt[0]){chomp $xgt[0]; edata($xgt[0]); @gt=(header,price,intro,bullets,outro,jobr,cldt,hwer,outro2,cdet); foreach $l(@gt){chomp $l;chomp $$l;$$l=~s!\n!
!g;} $rt=hblock($header,$price); $out.= qq~$tr $tr$rt$blank~; if($intro){$out.= qq~$tr$intro$blank~; } if($bullets){ $bullets=~s!\!\n!gi;$bullets=~s!\r!\n!gs;$bullets=~s!\n+!\n!gs; @pl=split(/\n/,$bullets); foreach $bit(@pl){chomp $bit;if($bit){$grab=brow($bit);$out.= qq~$tr$ts$grab$te~;}} $out.= $blank; } if($outro){$out.= qq~$tr$outro$blank~; } if($jobr){$out.= qq~$trJob Ref: $jobr$blank~; } if($cldt){$out.= qq~$trClosing Date: $cldt$blank~; } if($hwer){$out.= qq~$trHours Per Week: $hwer$blank~; } $outro2=~s![\n\r\s]!!gs; if($outro2){$out.=qq~$trContact Email : $outro2$blank~; } if($cdet){$out.= qq~$tr
Contact Details: $cdet
$blank~; } if($showdate){ $now=nicedate($tt[1]); $out.= qq~ $trJob last updated:   $now~; } $lad=($indextype==2 && !$sideindex)?qq~ \| Back to Jobs Index~:''; $out.= qq~$blank$tr $toplink$lad ~; $out.= qq~$tr$hr~; } }# end foreach $el(@store) $out.= qq~$sbox$moretag$tr$te\n$footer~; my ($sibase,$xmenbit)=sibase($menbit); $out.=$sibase; $out=~s!menbit\_here!$xmenbit!g; print $out; print $base; } ############################################################################################## sub moretag ($$;$){ my($snum,$sp,$all)=@_; my($ynum,$xnum,$pnum,$ret,$as,$ae,$totnum,$se,$sae,$int,$sep,$xfsize,); $xfsize=($ssize.'px'); $sstyle=qq~font-family:$font;font-size:$xfsize;color:\#$link~; $sbstyle=qq~font-family:$font;font-size:$xfsize;color:\#$textcolour~; my $qsnum = $snum; $qsnum--; $nexttag=$qsnum+$resperpage+1;$nexttag=(($snum+$resperpage)<($#store+1))?('  Next'):''; $prevtag=$qsnum-$resperpage+1;$prevtag=($snum>0)?('  Previous'):''; $nexttag=($sideindex=~/[lr]/i)?$nexttag:''; $prevtag=($sideindex=~/[lr]/i)?$prevtag:''; $totnum=($#store+1);$resperpage||=$totnum; $moretag=''; $sa=($snum+1);$se=($snum+$resperpage); $se=($se>$totnum)?$totnum:$se;$sae=($se!=$sa)?qq~$sa \- $se~:qq~$sa~; $xnum=0;$pnum=0; $int=($indextype==2)?qq~$indexheader:  ~:''; $indexheader=($indextype == 0)?qq~~:$indexheader; if($resperpage<$totnum){$moretag = qq~$tr $int~; while($xnum<$totnum){ $ynum=($xnum+1);while($ynum<($xnum+($resperpage+1))){$ret="k$ynum";$l_ha{$ret}=qq~$xnum~;$ynum++;} $sa=($xnum+1);$se=($xnum+$resperpage); $se=($se>$totnum)?$totnum:$se;$sae=($se!=$sa)?qq~$sa\-$se~:qq~$sa~; $sep=' | '; if(!($indextype==2)){$sae=('('.$pnum.')'); $sae=($xnum)?$sae:''; $htag=($xnum)?' ':'Jobs Archive:  '; $sep='';} $as=($all || $xnum!=$snum || ($indextype==2 && !$PROCESS{sp}))?(''):''; $ae=($all || $xnum!=$snum || ($indextype==2 && !$sp))?'':''; $moretag.=qq~$sep$as$sae$ae$htag~; $pnum++;$xnum+=$resperpage;} $moretag.=qq~$prevtag$nexttag blink_here$hralt~; } $blink=($snum<1 || ($indextype==2))?'':qq~ $curlink~;$moretag=~s!blink\_here!$blink!; $moretag=($itemindex)?$moretag:''; return($moretag); } ############################################################################################## sub menbit { my($snum,$xsnum,$sp)=@_; #print qq~dd $snum,$xsnum,$sp bb
~; my($xfsize,$xhzize,$hstyle,$sbstyle,$xnum,$unum,$enum,$start,$end,$ret,$anchor); $xfsize=($ssize.'px');$xhzize=($hsize.'px'); $hstyle=qq~font-weight:bold;font-family:$font;font-size:$xhzize;color:\#$textcolour;~; $sbstyle=qq~font-family:$font;font-size:$xfsize;color:\#$textcolour~; if($indextype){ if(!(($indextype==2 && $snum>0)||($indextype==2 && $PROCESS{sp}))||($sideindex)){ $xnum=1;$unum=0;$enum=($#store+1); $end=qq~$tr ~; if($indextype==1){$xnum=$xsnum+1;$unum=$xsnum; $enum=$resperpage+$snum;$enum=($enum>($#store+1))?($#store+1):$enum; $end="$blank";$start=qq~$hralt In This Section:~;} $menbit=$start; while($unum<$enum){ $l=$store[$unum];chomp $l; @tt=split(/\|/,$l); chomp $tt[0]; chomp $tt[2]; $ret="k$xnum"; $lad=(($l_ha{$ret}!=$snum)||$indextype==2)?($my_http.'?'.$sp.'s='.$l_ha{$ret}.$ptag):''; $anchor=($resperpage>1)?qq~\#tag$xnum~:'#'; $menbit.= qq~$te~;$unum++;$xnum++;} $menbit.= qq~$end~; } } return($menbit); } ############################################################################################## sub sitop { my($out,$lstyle,$fsize); $fsize=($tsize.'px'); $lstyle=qq~font-weight:bold;font-family:$font;font-size:$fsize;color:\#$textcolour;~; if($sideindex){ $siwidth=($displaywidth+220); $out=qq~
$tt[2]~; if($showdate){$menbit.=qq~
$tt[3]~;} $menbit.=qq~
\n~; if($sideindex=~/l/i){$out.=qq~
menbit_here   ~;} elsif($sideindex=~/r/i){$out.=qq~\n\n~;} } # end if($sideindex) return $out; } ############################################################################################# sub sibase { my($menbit)=@_; my($xmenbit,$out,$nhstyle,$fsize); $fsize=($tsize.'px'); $nhstyle=qq~font-weight:bold;font-family:$font;font-size:$fsize;color:\#$alink;~; if($sideindex=~/r/i){$out.=qq~   menbit_here
~;} elsif($sideindex=~/l/i){$out.=qq~\n\n~;} if($sideindex){ $xmenbit=qq~ $menbit
$indexheader
 
~; } # end if($sideindex) return($out,$xmenbit); } ############################################################################################# sub htip { my(@head); xtbits(); my $lstyle=('font-size:12px;font-family:'.$font); my $hi=qq~~; my $st=qq~$tr&\#149;  $st bgcolor="\#ececec">Web addresses of the form $hiwww.anaddress.com and email addresses of the form$hi somename\@anaddress.co.uk will be converted automatically to hyperlinks. $st>Where a web address does not contain www then 'http://' must precede it.
E.g. $hiir.diageo.com will not be converted to a hyperlink but $hihttp://ir.diageo.com will be. $st bgcolor="\#ececec">Besides 'http://' the protocols 'https://' and 'ftp://' are recognised. $st>To provide a linked address behind a different label, the label required should be enclosed in double triangular brackets - << >> (Greater than & less than signs)
$hiwww.hibyte.co.uk<<Hibyte's Website>> will produce a link of the form Hibyte's Website
$hisimon\@hibyte.co.uk<<Email Simon>> will produce a link of the form Email Simon $st bgcolor="\#ececec">To open a link in a new window, specify the target like this: $hi target:_blank in single triangular brackets.
$hi www.hibyte.co.uk<<Hibyte's Website>><target:_blank> produces a link of the form Hibyte's Website opening in a new window.~; $st=~s!\&\#149\;!\ \;!; print qq~ $st> $st bgcolor="\#ececec">§ Print this page  \|   Close window    © Hibyte 2001
~; } ############################################################################################# sub footer { my $fsize=($tsize.'px'); my $xfsize=$tsize-1;$xfsize.='px'; $hr=qq~
~; $hralt=qq~
~; if($footer){$footer=qq~
§ Print this page   \|  expand recruitment Ltd Brighton Recruitment Consultants  UK - All Rights Reserved
$hr~;}else{$footer='';}} ############################################################################################# sub xhead ($$$$$$$$$;$) {my($title,$bg,$link,$vis,$act,$hov,$txt,$font,$fsize,$range)=@_; my($gtitle,$r,$rt,$sbit,$htop,$js,$bbit,$hend,@rn);$gtitle=($leg)?qq~HiJobss Editor - $title~:$title; $fsize.='px';$htop=qq~\n\n$title ~; $hend=qq~\n\n