#!/usr/bin/perl use LWP::UserAgent; use XML::Simple; use utf8; require "config.cgi"; require "russian.cgi"; &GetFormInput; my $page1 = $ENV{'REQUEST_URI'}; my $reqip = $ENV{'REMOTE_ADDR'}; my $pagekey = $field{$config{'pagekey'}}; my $product = $field{$config{'product'}}; my $att_string = $field{$config{'att_string'}}; my $id_category = $field{$config{'id_category'}}; my $name_category = $field{$config{'name_category '}}; my $page_category = $field{$config{'page_category'}}; my $att = $field{$config{'att'}}; my $search = $field{$config{'search'}}; my $tab = $field{$config{'tab'}}; my $view = $field{$config{'view'}}; my $debug = $field{'debug'}; my $productsort = $field{'sort'}; my @arr_product; my $subcategorycount; my $refcat; my $product_title; my $category_title; my $catname; my $COOKIE; my $gridurl; my $listurl; my $pricesorturl; my $ratesorturl ; my $latestsorturl; my $productrate = "/templ/img/0_5stars.gif"; &getcookies; if ($view eq "" ){if(exists $COOKIE{view}) {$view = $COOKIE{view};}else{&setcookie}}else{&setcookie}; #$showAllDescendants = "true"; my $main_table; my $att_table; my $itemscount =0 ; my $page = $p ; my $perpage = 10; my $title; my $metakeys; my $metadesk; my $currenturl; my $mainpage = 0; my $attaddurl; my $attrequrl; my %atthash; print "Content-type:text/html \n\n"; if ($debug eq "true"){ print " api:$config{'defaultapiserver'}
$config{'apiKey'}-$config{'trackingId'}
$config{'path'}}"; } if ((($product == 0)or($product eq "")) and(($id_category eq "")or($id_category == 0))){$mainpage = 1;$id_category=0; }; if (($product eq "") and ($search eq "")){ if ($debug eq "true"){ print "$config{'defaultapiserver'}?categoryid=$id_category&showAllDescendants=true&apiKey=$config{'apiKey'}&trackingid=$config{'trackingId'}";} $xmlcat = get("$config{'defaultapiserver'}?categoryid=$id_category&showAllDescendants=true&apiKey=$config{'apiKey'}&trackingid=$config{'trackingId'}"); $refcat = XMLin($xmlcat, forcearray=>1); $subcategorycount = &GetSubcategoryCount($refcat); } if ((($id_category ==0)or($subcategorycount > 0))and($search eq "") ) { if ($debug eq "true"){ print "$config{'defaultapiserver'}?productid=$product&categoryid=$id_category&pageNumber=$page_category&keyword=$search&attributeValue=$att&apiKey=$config{'apiKey'}&numItems=$config{'itemperpage'}&trackingid=$config{'trackingId'}&clientip=$reqip"; } $xml = get("$config{'defaultapiserver'}?productid=$product&categoryid=$id_category&pageNumber=$page_category&keyword=$search&attributeValue=$att&apiKey=$config{'apiKey'}&numItems=$config{'itemperpage'}&trackingid=$config{'trackingId'}&clientip=$reqip"); $view= "list"; } else { ($attaddurl,$attrequrl,%atthash) = &urlbuilderatt($att); if ($debug eq "true"){ print "$config{'defaultapiserver'}?productid=$product&categoryid=$id_category&pageNumber=$page_category&keyword=$search&apiKey=$config{'apiKey'}&productSortType=$productsort&numItems=$config{'itemperpage'}&trackingid=$config{'trackingId'}$attrequrl&clientip=$reqip";} $xml = get("$config{'defaultapiserver'}?productid=$product&categoryid=$id_category&pageNumber=$page_category&keyword=$search&apiKey=$config{'apiKey'}&productSortType=$productsort&numItems=$config{'itemperpage'}&trackingid=$config{'trackingId'}$attrequrl&clientip=$reqip");} my $ref = XMLin($xml, forcearray=>1); my $it1= 0; &geturls; &urlbuilder(); &templatebuilder($id_category); ############################################################################ sub GetFormInput { (*fval) = @_ if @_ ; local ($buf); if ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN,$buf,$ENV{'CONTENT_LENGTH'}); } else { $buf=$ENV{'QUERY_STRING'}; } if ($buf eq "") { return 0 ; } else { @fval=split(/&/,$buf); foreach $i (0 .. $#fval){ ($name,$val)=split (/=/,$fval[$i],2); $val=~tr/+/ /; $val=~ s/%(..)/pack("c",hex($1))/ge; $name=~tr/+/ /; $name=~ s/%(..)/pack("c",hex($1))/ge; if (!defined($field{$name})) { $field{$name}=$val; } else { $field{$name} .= ",$val"; } } } return 1; } ############################################################################ ############################################################################ sub get { my $url = shift; my $proxy = shift; my $timeout =2; my $config = shift; my $cookie = ''; my $sock; $timeout = 200; my $ua = LWP::UserAgent->new; $ua->timeout($timeout); my $headers = HTTP::Headers->new; my $request = HTTP::Request->new('GET', $url, $headers); my $response = $ua->request($request); my $content = ($response->is_success) ? $response->content : ''; return $content; } ############################################################################ ############################################################################ sub productlist { my $specifications; my $starttbl; my $endtable; if ($product eq ""){ #$starttbl = ""; #$endtable = "
"; if (($view eq "list") or ($view eq "")) {$product_content = &templreader("product_list_item"); $product_content_delt = ""; } elsif ($view eq "grid") {$product_content = &templreader("product_grid_item"); $product_content_delt = &templreader("product_grid_item_delt"); } } else{$product_content = &templreader("product");} $itemlist = "$starttbl"; for my $customer (@{$ref->{categories}}) { for my $customer1 (@{$customer->{category}}) { $catname = @{$customer1->{name}}[0]; $catid = $customer1->{id}; for my $customer2 (@{$customer1->{items}}) { $itemscount = $customer2->{matchedItemCount}; $page = $customer2->{pageNumber}; $perpage = $customer2->{returnedItemCount}; my $del_cont = 0; for my $customer3 (@{$customer2->{product}}) { my $id = $customer3->{id}; my $name = @{$customer3->{name}}[0]; my $mprice = @{$customer3->{maxPrice}}[0]; my $minprice= @{$customer3->{minPrice}}[0]; my $fdesk=@{$customer3->{fullDescription}}[0]; my $sdesk = @{$customer3->{shortDescription}}[0]; ($offerslist,$offerscount,$samllofferlist) = &OffersList($customer3); $offerscount = &rusnum($offerscount,"shop"); # $offerscount = $forms{"offer1"}; ($reviewlist,$reviewcount) = &Productreview($customer3); $reviewcount = &rusnum($reviewcount,"review"); @arr_url = &urlbuilder($id); $specifications =@{$customer3->{specifications}}[0]; $specifications = &ProductDetail($specifications); $m1 = $product_content; $m1 =~ s/<-SMALL_PRICE->/$samllofferlist/g; $m1=~s/<-PRODUCT_ID->/$id/g; $m1=~s/<-PRODUCT_NAME->/@{$customer3->{name}}[0]/g; $m1=~s/<-OFFERS_COUNT->/$offerscount/g; $m1=~s/<-PRICE_MIN->/@{$customer3->{minPrice}}[0]/g; $m1=~s/<-PRICE_MAX->/@{$customer3->{maxPrice}}[0]/g; $m1=~s/<-SHOT_DESK->/@{$customer3->{shortDescription}}[0]/g; $m1=~s/<-PRODUCT_DESK->/@{$customer3->{fullDescription}}[0]/g; $m1=~s/<-PRODUCT_SPEC->/$specifications/g; $m1 =~ s/<-PRICE_COMPARE_URL->/$arr_url[0]/g; $m1 =~ s/<-DETAIL_URL->/$arr_url[1]/g; $m1 =~ s/<-REVIEW_URL->/$arr_url[2]/g; $m1 =~ s/<-REVIEW_COUNT->/$reviewcount/g; $m1 =~ s/<-RATE_IMAGE->/$productrate/g; $m1 =~ s/<-PRICE_COMPARE_TEXT->/$config{'comparepricetext'}/g; $m1 =~ s/<-DETAIL_TEXT->/$config{'detailtext'}/g; $m1 =~ s/<-REVIEW_TEXT->/$config{'reviewstext'}/g; $product_title = @{$customer3->{name}}[0]; for my $customer31 (@{$customer3->{images}}) { for my $customer312 (@{$customer31->{image}}) { if ($customer312->{size} eq "small" ) { $m1=~s/<-PRODUCT_IMAGE->/@{$customer312->{sourceURL}}[0]/g;} elsif ($customer312->{size} eq "big" ) { $m1=~s/<-PRODUCT_IMAGE_BIG->/@{$customer312->{sourceURL}}[0]/g;} } } if ($del_cont > 2){$itemlist .=$product_content_delt; $del_cont=0;} $del_cont++; $itemlist .= $m1; }}}} $itemlist .="$endtable"; return $itemlist,$offerslist,$specifications,$itemscount,$page,$perpage,$reviewlist,$reviewcount; } ############################################################################ ############################################################################ sub CategoryPath { my @arr = @_; my $itemlist; for my $customer (@{$ref->{browseHistory}}) { for my $customer1 (@{$customer->{categorySelection}}) { $att_name= @{$customer1->{name}}[0]; $arr_id=$customer1->{id}; if ($category_title eq ""){$category_title =$att_name;} $itemlist ="$att_name  » ".$itemlist; } } $itemlist ="$config{'mainpagetext'}  »  ".$itemlist; return $itemlist; } ############################################################################ ############################################################################ sub attribute_list { my @arr = @_; my $itemlist ; if ($attaddurl eq "&$config{'att'}="){$attaddurl="";} for my $customer (@{$ref->{categories}}) { for my $customer1 (@{$customer->{category}}) { for my $customer21 (@{$customer1->{attributes }}) { for my $customer23 (@{$customer21->{attribute }}) { $att_name= @{$customer23->{name}}[0]; $att_id = $customer23->{id}; $itemlist .= "
$att_name
"; $class = ""; for my $customer24 (@{$customer23->{attributeValues}}) { for my $customer25 (@{$customer24->{attributeValue}}) { $att_name= @{$customer25->{name}}[0]; $att_id = $customer25->{id}; $arr_count= $customer25->{matchedValueCount}; if (length($class)== 0){$class = 'class="white"';}else{$class="";}; if (exists($atthash{"$att_id"})) { my $curratt = "&"."$config{'att'}=$att_id"; my $attaddurl1 = $attaddurl; $attaddurl1 =~ s/$curratt//g; # (X) $itemlist .= "
  • "; } else { $itemlist .= "
  • "; } } } $itemlist .= "
    "; }}}} return $itemlist; } ############################################################################ ############################################################################ sub templreader { my @arr = @_; if (open (TempDat,"<:utf8", "$config{'path'}/templ/$arr[0].tpl") ==0){ print " Template read error, check path.
    $config{'path'}/templ/$arr[0].tpl "; exit; } else {return join ('', );} } ############################################################################ ############################################################################ sub templatebuilder { my @arr = @_; # main page template my $main_table = &templreader("index"); # category path reader my $categorypath = &CategoryPath; # attribute list reader my $attlist = &attribute_list; my $catlist; # product list reader my($itemlist,$offer_table,$specifications,$itemscount,$pagenum,$perpagenum,$reviewlist,$reviewscount) = &productlist; my $startfrom = ($pagenum*$perpagenum)+1; $startend = (($pagenum*$perpagenum)+1)+$perpagenum; if ($startend >$itemscount){$startend = $itemscount;}; $itemscount = &rusnum($itemscount,"product"); # if categoryId eq "0" show main content with all category , else get category list if ($arr[0] ne '0' ){$catlist= &CategoryList; } else{$catlist = &MainPageContent;} # page count reader $pagestring = &pager; # create title,keywords,description &CreateTitle; $count = &counter(); $att_table = &templreader("attribute_list"); $header_table = &templreader("header"); $page_table = &templreader("pager"); $footer_table = &templreader("footer"); $user_counter = &clientfile("counter"); $user_banner = &clientfile("banner"); $user_banner1 = &clientfile("banner1"); $user_banner2 = &clientfile("banner2"); $page_table =~ s/<-PAGER1->/$pagestring /g; $att_table =~ s/<-ATTLIST1->/$attlist/g; # main content if ($product eq ""){ # $content_table = &templreader("item_list_table");} else { $content_table = $itemlist; if ($tab eq "") {$tabcontent = $offer_table; } elsif ($tab eq "2") {$tabcontent = &ProductDetail($specifications);} elsif ($tab eq "3") {$tabcontent = $reviewlist;} } if ($subcategorycount != 0){$content_table = &templreader("sub_category_table");}; #creaete template $main_table =~ s/<-PAGE_CONTENT->/$content_table/g; $main_table =~ s/<-HEADER->/$header_table/g; $main_table =~ s/<-FOOTER->/$footer_table/g; $main_table =~ s/<-ITEMLIST->/$itemlist/g; $main_table =~ s/<-TAB_CONTENT->/$tabcontent/g; $main_table =~ s/<-REVIEW_CONTENT->/$reviewlist/g; $main_table =~ s/<-ATTLIST->/$att_table/g; $main_table =~ s/<-PAGER->/$page_table/g; $main_table =~ s/<-PAGER_PRODUCT_START->/$startfrom/g; $main_table =~ s/<-PAGER_PRODUCT_END->/$startend/g; $main_table =~ s/<-CATPATH->/$categorypath/g; $main_table =~ s/<-CATEGORY_LIST->/$catlist/g; $main_table =~ s/<-CATEGORY_NAME->/$catname/g; $main_table =~ s/<-ITEMS_COUNT->/$itemscount/g; $main_table =~ s/<-META_TITLE->/$title/g; $main_table =~ s/<-META_DESK->/$metadesk/g; $main_table =~ s/<-META_KEYS->/$metakeys/g; $main_table =~ s/<-CURRENT_URL->/$currenturl/g; $main_table =~ s/<-PRICE_COMPARE_TEXT->/$config{'pricecomparetext'}/g; $main_table =~ s/<-DETAIL_TEXT->/$config{'detailtext'}/g; $main_table =~ s/<-REVIEW_TEXT->/$config{'reviewtext'}/g; $main_table =~ s/<-SORT_BY_PRICE->/$pricesorturl/g; $main_table =~ s/<-SORT_BY_LATEST->/$latestsorturl/g; $main_table =~ s/<-SORT_BY_RATE->/$ratesorturl/g; $main_table =~ s/<-VIEW_GRID->/$gridurl/g; $main_table =~ s/<-VIEW_LIST->/$listurl/g; $main_table =~ s/<-COUNTER->/$count/g; $main_table =~ s/<-USER_COUNTER->/$user_counter/g; $main_table =~ s/<-BANNER->/$user_banner/g; $main_table =~ s/<-BANNER1->/$user_banner1/g; $main_table =~ s/<-BANNER2->/$user_banner2/g; $main_table =~ s/<-SITE_URL->/$config{'siteurl'}/g; print "$main_table"; } ############################################################################ ############################################################################ sub pager { my $pagerstring = ""; my $istart = 0; $iz=0; my $iend = $itemscount/$perpage; if ($iend > $page+8){$iend=$page+8;}; if ($page >=15){$istart=$page-8;}; if ($perpage == 0){return ""}; while ($istart < (($iend))) { if ($istart == $page){ $iz=$istart+1; $pagerstring .= "$iz ";}else{$iz=$istart+1; $pagerstring .= "$iz ";} $istart++; } return $pagerstring; } ############################################################################ ############################################################################ sub urlbuilder { my @arr = @_; my $att_url; $price_url = "?$config{'product'}=$arr[0]"; $detail_url = "?$config{'product'}=$arr[0]&$config{'tab'}=2"; $review_url = "?$config{'product'}=$arr[0]&$config{'tab'}=3"; return $price_url,$detail_url,$review_url; } ############################################################################ ############################################################################ sub urlbuilderatt { my @arr = @_; my $att_url22; my $att_url11; my %currentatthash; if (index ($arr[0],",") == -1){ $att_url22 .= "&"."$config{'att'}=$arr[0]"; $att_url111 .="&"."attributeValue=$arr[0]"; $currentatthash{$arr[0]}=$arr[0]; return $att_url22,$att_url111,%currentatthash; } my @atturl = split /,/,$arr[0]; for my $attitem (@atturl) { $att_url22 .= "&"."$config{'att'}=$attitem"; $att_url11 .="&"."attributeValue=$attitem"; $currentatthash{$attitem}=$attitem; } return $att_url22,$att_url11,%currentatthash; } ############################################################################ ############################################################################ sub OffersList { my @arr = @_; my $offerlist = ""; my $samllofferlist = ""; my $smalit=0; my $offers_table = &templreader("off_list"); my $offers_item_table_tmp = &templreader("off_item"); my $offers_table_small = &templreader("off_list_small"); for my $customer (@{$arr[0]->{offers}}) { $offers_count= $customer->{matchedCategoryCount}; my $class = ""; for my $customer1 (@{$customer->{offer}}) { $offers_item_table = $offers_item_table_tmp; $offers_item_table =~ s/<-OFFER_IMAGE->/@{$customer1->{manufacturer}}[0]/g; $offers_item_table =~ s/<-OFFER_PRICE->/@{$customer1->{basePrice}}[0]/g; $offers_item_table =~ s/<-OFFER_URL->/@{$customer1->{offerURL}}[0]/g; my $country = @{$customer1->{country}}[0]; if(exists $config{$country}){$country = $config{$country};}; $tmpnamer = "@{$customer1->{name}}[0]
    @{$customer1->{description}}[0]"; $offers_item_table =~ s/<-OFFER_DESK->/$tmpnamer/g; $offers_item_table =~ s/<-OFFER_DESK_CLEAR->/@{$customer1->{description}}[0]/g; $offers_item_table =~ s/<-OFFER_NAME->/@{$customer1->{name}}[0]/g; for my $customer2 (@{$customer1->{store}}) { $offers_item_table =~ s/<-OFFER_SHOP_IMAGE->/@{$customer2->{logo}}[0]/g; $offers_item_table =~ s/<-OFFER_SHOP_NAME->/@{$customer2->{name}}[0]/g; $offers_item_table =~ s/<-OFFER_COUNTRY->/$country/g; if ($smalit < 5){ my $offers_item_table_tmp_small = &templreader("off_item_small"); my $shopnamesub = substr @{$customer2->{name}}[0],0,17; if (length(@{$customer2->{name}}[0])>17){$shopnamesub .="...";}; if (length($class)== 0){$class = 'class="blue"';}else{$class="";}; $offers_item_table_tmp_small =~ s/<-OFF_ITEM_SMALL_CLASS->/$class/g; $offers_item_table_tmp_small =~ s/<-OFFER_SHOP_NAME->/$shopnamesub/g; $offers_item_table_tmp_small =~ s/<-OFFER_COUNTRY->/""/g; $offers_item_table_tmp_small =~ s/<-OFFER_PRICE->/@{$customer1->{basePrice}}[0]/g; $offers_item_table_tmp_small =~ s/<-OFFER_URL->/@{$customer1->{offerURL}}[0]/g; $samllofferlist .= $offers_item_table_tmp_small;} } $smalit++; $offerlist .= $offers_item_table; } } $offers_table_small =~ s/<-OFF_ITEMS_SMALL->/$samllofferlist/g; $offers_table =~ s/<-OFFERS_LIST->/$offerlist/g; return $offers_table,$offers_count,$offers_table_small ; } ############################################################################ ############################################################################ sub ProductDetail { my @arr = @_; my $detail_table_item_cont; my $detail_table_item_tmp; my $detail_table = &templreader("detail_table"); my $detail_table_item = &templreader("detail_table_item"); @fval=split(/
    /,$arr[0]); foreach $i (0 .. $#fval){ ($name,$val)=split (/:/,$fval[$i]); $detail_table_item_tmp = $detail_table_item; $detail_table_item_tmp =~ s/<-DETAIL_NAME->/$name/g; $detail_table_item_tmp =~ s/<-DETAIL_VALUE->/$val/g; $detail_table_item_cont .= $detail_table_item_tmp; } $detail_table =~ s/<-DETAIL_TABLE_CONTENT->/$detail_table_item_cont/g; return $detail_table; } ############################################################################ ############################################################################ sub Productreview { my @arr = @_; my $reviewslist = ""; my $reviews_table = &templreader("review_list"); my $reviews_item_table_tmp = &templreader("review_item"); for my $customer (@{$arr[0]->{reviews}}) { $reviews_count= $customer->{matchedCategoryCount}; for my $customer1 (@{$customer->{review}}) { $reviews_item_table = $reviews_item_table_tmp; $reviews_item_table =~ s/<-REVIEW_PLUS->/@{$customer1->{plus}}[0]/g; $reviews_item_table =~ s/<-REVIEW_MINUS->/@{$customer1->{minus}}[0]/g; $reviews_item_table =~ s/<-REVIEW_REVIEW->/@{$customer1->{reviewfull}}[0]/g; $reviews_item_table =~ s/<-REVIEW_USER->/@{$customer1->{user}}[0]/g; $reviewslist .= $reviews_item_table; } } $reviews_table =~ s/<-REVIEW_LIST->/$reviewslist/g; return $reviews_table,$reviews_count ; } ############################################################################ ############################################################################ sub GetSubcategoryCount { my @arr = @_; for my $customer (@{$arr[0] ->{category}}) { return @{$customer->{categories}}[0]->{matchedCategoryCount}; } } ############################################################################ ############################################################################ sub CategoryList { my @arr = @_; $tempret= ""; my $i = 0; for my $customer (@{$refcat ->{category}}) { for my $customer1 (@{$customer->{categories}}) { for my $customer2 (@{$customer1 ->{category}}) { $tempret .= "{id}\">".@{$customer2->{name}}[0].""; $tempret .= "
    "; } } } return $tempret; } ############################################################################ ############################################################################ sub MainPageContent { my @arr = @_; $tempret = ""; return $tempret; } ############################################################################ ############################################################################ sub CreateTitle { my @arr = @_; #product title by default $metadesk = &templreader("product_desk"); $title = &templreader("product_title"); $metakeys= &templreader("product_keys"); #main page title if ($mainpage == 1) { $metadesk = &templreader("main_desk"); $title = &templreader("main_title"); $metakeys= &templreader("main_keys");} #category page title if (($product == 0)and($mainpage == 0)) { $metadesk = &templreader("category_desk"); $title = &templreader("category_title"); $metakeys= &templreader("category_keys");} if ($tab == "2"){$title = $config{'detailtext'}." ".$title; $metadesk = " $config{'detailtext'} ".$metadesk; } if ($tab == "3"){$title = $config{'reviewtext'}." ".$title; $metadesk = " $config{'reviewtext'} ".$metadesk; } $title =~ s/<-META_NAME->/$product_title/g; $title =~ s/<-META_ITEM_GROUP_NAME->/$category_title/g; $metakeys =~ s/<-META_NAME->/$product_title/g; $metakeys =~ s/<-META_ITEM_GROUP_NAME->/$category_title/g; $metadesk =~ s/<-META_NAME->/$product_title/g; $metadesk =~ s/<-META_ITEM_GROUP_NAME->/$category_title/g; } ############################################################################ ############################################################################ sub setcookie { #local($tempsetcookieinfo) = @_; #($cookiename,$cookievalue,$cookieexp) = split(/\,/,$tempsetcookieinfo); print "Set-Cookie: view=$view\;"; $cookieexp =1; if ($cookieexp) { $currenttime = time; $expstamp = $cookieexp * 86400 + $currenttime; @daysofweek = ('Sun','Mon','Tue','Wed','Thr','Fri','Sat'); @months = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($expstamp); if ($mday < 10) { $mday = "0$mday"; } $year = $year + 1900; $cookieexpdate = "$daysofweek[$wday], $mday-$months[$mon]-$year 00:00:00 GMT"; print " expires=$cookieexpdate\;"; } print "\n"; } ########################## # Get cookies. sub getcookies { my @pairs = split(/; /,$ENV{'HTTP_COOKIE'}); foreach $pair (@pairs) { my ($name,$value) = split(/=/,$pair); $COOKIE{$name} = $value; } } ############################################################################ ############################################################################ sub geturls { $baseurl = "/"; if ($product eq ""){ $gridurl = "?$config{'id_category'}=$id_category&$config{'view'}=grid"; $listurl = "?$config{'id_category'}=$id_category&$config{'view'}=list"; $pricesorturl = "?$config{'id_category'}=$id_category&sort=price$attaddurl"; $ratesorturl = "?$config{'id_category'}=$id_category&sort=rate$attaddurl"; $latestsorturl = "?$config{'id_category'}=$id_category&sort=new$attaddurl"; } } ############################################################################ ############################################################################ sub counter { $lister = ""; return $lister; } ############################################################################ ############################################################################ sub atturl { } ############################################################################ ############################################################################ sub clientfile { my @arr = @_; my $pathuserfile = "$config{'path'}/templ/$arr[0].txt" ; if (-e $pathuserfile) { if (open (TempDat,"<:utf8", $pathuserfile) ==0){ print " Template read error, check path.
    $pathuserfile "; exit; } else {return join ('', );} } } ############################################################################ ############################################################################ sub rusnum { # my @arr = @_; $lastnum = $arr[0]; if ($arr[0] > 20){ $lastnum = int(substr $arr[0],-2); if ($lastnum > 20) { $lastnum = int(substr $arr[0],-1); }} if ($lastnum == 1) { $form = $forms{"$arr[1]1"}; } elsif ($lastnum > 1 && $lastnum < 5) { $form = $forms{"$arr[1]2"};; } else { $form = $forms{"$arr[1]5"}; } return "$arr[0] $form "; }