package LoadProperties; use SharedVariable qw (%ARTICLE) #### $fabricant = $lp->loadFabricantProperties($ARTICLE{'marque'},'',$value); #### package SharedVariable; use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); use Time::HiRes qw(gettimeofday); use Compress::Zlib; use CGI::Session qw/-ip-match/; use vars qw (%ENV $session_dir $page $dir $dirLang $dirError $imgdir $action $t0 $session_id $can_do_gzip $current_ip $lang $LANG %ARTICLE %SESSION %SERVER %USER $CGISESSID %LABEL %ERROR %VALUE $COMMANDID %COMMAND %DATE %PAYPALL $INDEX %LINK $query $session $host $t0 $client); #Set the values to the global variables $query = CGI->new ; $current_ip = $ENV{'REMOTE_ADDR'}; $client = $ENV{'HTTP_USER_AGENT'}; $t0 = gettimeofday(); $host = "http://avant-garde.no-ip.biz"; %ERROR = ();%LABEL = ();$LANG = "";%LINK = ();%ARTICLE = ();%SESSION = ();%SERVER = (); % $action = $query->param('action'); $page = $query->param("page"); $session_id = $query->param('session'); $can_do_gzip = ($ENV{'HTTP_ACCEPT_ENCODING'} =~ /gzip/i) ? 1 : 0; $dir = "/home/alexandre/apache/site/recordz1/"; $dirLang = "/home/alexandre/apache/site/recordz1/lang"; $dirError = "/home/alexandre/apache/site/recordz1/lang"; $imgdir= "/home/alexandre/apache/site/recordz1/upload"; $session_dir = "/home/alexandre/apache/site/recordz/sessions"; $action = $query->param('action'); $session_id = $query->param('session'); if ($session_id eq '' or $session_id eq '$SESSIONID') { $session = new CGI::Session("driver:File", undef, {Directory=>"$session_dir"}); $session_id = $session->id(); } #load html label loadLanguage (); #load error label loadError(); sub new { my $class = shift; my ($opts)= @_; my $self = {}; return bless $self, $class; } sub loadLanguage { $lang = $query->param("lang"); #$lang = substr ($ENV{'HTTP_ACCEPT_LANGUAGE'},0,2); #$lang =~ s/[^A-Za-z0-9 ]//; $lang = uc ($lang); open (FILE, "<$dirLang/$lang.conf") or die "cannot open file $dirLang/$lang.conf"; while () { (local our $label, local our $value) = split(/=/); $SERVER{$label} = $value; } close (FILE); } sub loadError { $lang = lc ($query->param('lang'));#=~ s/[^A-Za-z0-9 ]//; #$lang=~ s/[^A-Za-z0-9 ]//; open (FILE, "<$dirError/$lang.conf") or die "cannot open file $dirError/$lang.conf"; while () { (local our $label, local our $value) = split(/=/); $SERVER{$label} = $value; } close (FILE); } BEGIN { use Exporter (); @SharedVariable::ISA = qw(Exporter); @SharedVariable::EXPORT = qw(gettimeofday()); @SharedVariable::EXPORT_OK = qw ($session_dir $page $action $dir $dirLang $dirError $imgdir $session_id $can_do_gzip $current_ip $lang $LANG %ARTICLE %SESSION %SERVER %USER $CGISESSID %LABEL %ERROR %VALUE $COMMANDID %COMMAND %DATE %PAYPALL $INDEX %LINK $query $session $host $t0 $client); } 1; #### sub getLastEnchereurDetail { local our $string;local our $article = $query->param("article"); local our $ref_max_enchereur; local our $max_enchere; ($ARTICLE{'max_enchere'})=$mydb->sqlSelect1("MAX(prix)", "enchere", "ref_article = '$article'"); if ($ARTICLE{'max_enchere'} ne '') { ($ARTICLE{'max_enchereur'},$ARTICLE{'id_enchere'})=$mydb->sqlSelect1("ref_enchereur,id_enchere", "enchere", "ref_article = '$article' AND prix = $ARTICLE{'max_enchere'}"); ($ARTICLE{'nom_utilisateur_acheteur'},$ARTICLE{'email_acheteur'},$ARTICLE{'acheteur_lang'},$ARTICLE{'acheteur_adresse'},$ARTICLE{'acheteur_ville'},$ARTICLE{'acheteur_npa'},$ARTICLE{'acheteur_telephone'},$ARTICLE{'acheteur_nom'},$ARTICLE{'acheteur_prenom'})= sqlSelect("nom_utilisateur,email,lang,adresse,ville,npa,no_telephone,nom,prenom", "personne", "id_personne = '$ref_max_enchereur'"); } $string .= ""; $string .= "$ARTICLE{'nom_utilisateur_acheteur'}"; return $string; }