#!/usr/bin/perl #===================================================== # Система управления контентом Reactor #----------------------------------------------------- # http://www.reart.ru/ #----------------------------------------------------- # Данный программный код разработан и принадлежит # ООО "Реарт" г. Владимир. Он НЕ является свободно # распространяемым и НЕ бесплатным. Запрещена любая # модификация и распространение кода без согласования # с компанией Реарт. #----------------------------------------------------- # Дата установки системы: 03.02.2017 #----------------------------------------------------- # Copyright (c) 2001-2017 Компания Реарт #===================================================== # Переменные передаваемые скрипту при выводе меню каталога ?type=menu # from= номер базы, с которой начнет строится меню # java=1 меню раскрывается безе перезагрузки с помощью javascript # item=1 показывать в меню не только разделы, но и позиции # По-умолчанию в меню выводятся только разделы и если вместе с разделами идут позиции, то выводятся и они # После переменных можно вставлять &$QUERY_STRING тогда текущий раздел и позиция будут иметь класс selected $servis=$ENV{'SCRIPT_FILENAME'}; $servis=~ s/(\S+\/)(\w+)(\.\w+)/$2/; require "setup.cgi"; require "$servis/cfg.$ext"; if ($base ne "") {$servis=$base;} $config="$servis/cfg.$ext"; $users="admin/users.$ext"; require "lib.$ext"; @months = ('01','02','03','04','05','06','07','08','09','10','11','12'); @days = ('Вс','Пн','Вт','Ср','Чт','Пт','Сб'); ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime(time); if ($min =~/\d\d/) {$min="$min";} else {$min="0$min";} if ($hour =~/\d\d/) {$hour="$hour";} else {$hour="0$hour";} if ($mday =~/\d\d/) {$mday="$mday";} else {$mday="0$mday";} $year+=1900; $date1=qq($mday.$months[$mon].$year); $time1=qq($hour:$min); open (USERS, "$users"); @users=; close (USERS); read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); if (!$buffer) { $buffer=$ENV{'QUERY_STRING'}; } $http_referer=$ENV{'HTTP_REFERER'}; @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; $value =~ s//>/g; $value =~ s/\n\n/
/g; $value =~ s/\r\n/
/g; $value =~ s/\n/
/g; $value =~ s/\cM//g; $input{$name} = $value; } if ($input{info} eq "name") { print "Content-type: text/html\n\n"; print $description; exit; } if ($input{'base'} ne "" && $input{'base'} ne "last") { $base=$input{'base'}; $razdels="$servis/data$base.$ext"; $data="$servis/data$base.$ext"; } else {$razdels="$servis/data.$ext"; $base=""; $data="$servis/data.$ext";} open (RAZDELS, "$razdels"); @razd=; close (RAZDELS); @razd=reverse(@razd); if ($input{'base'} eq "last") { ($base)=split(/::/,$razd[0]); $razdels="$servis/data$base.$ext"; $data="$servis/data$base.$ext"; open (RAZDELS, "$razdels"); @razd=; close (RAZDELS); @razd=reverse(@razd); } open (DATA, "$data"); @list=; close (DATA); if ($input{news} eq "last" ) {$input{news}=$#list;} if ($input{news} eq "random" ) { $kolvo_pos=@list; $rn=rand $kolvo_pos; $input{news}=sprintf "%u", $rn; } if ($top_tml) {require "design/$top_tml.tml"; $top=$tml_design;} if ($top2_tml) {require "design/$top2_tml.tml"; $top2=$tml_design;} if ($bottom_tml) {require "design/$bottom_tml.tml"; $bottom=$tml_design;} if ($bottom2_tml) {require "design/$bottom2_tml.tml"; $bottom2=$tml_design;} $top=qq($top$top2); $bottom=qq($bottom$bottom2); if ($design_on) {$top=qq($main_top$top); $bottom=qq($bottom$main_bottom);} #if ($center_design ne "" or $center_design_top ne "" or $center_tml ne "" or $center_tml_top ne "") { #Читаем data файл, дабы поиметь описание разделов opendir (DIR, "$servis"); @directory=readdir(DIR); foreach $file (@directory){ if ($file =~ /data/){ open (RA, "$servis/$file"); @temp_razd=; close (RA); push (@raz, @temp_razd); } } $razd_end=@raz; $name=""; RAZDEL: for ($r=0;$r<$razd_end;$r++) { chomp $raz[$r]; ($base_num_tmp,$name_tmp,$desk_tmp)=split(/::/,$raz[$r]); if ($base eq $base_num_tmp) { $base_num=$base_num_tmp; $name=$name_tmp; $desk=$desk_tmp; $id=$r+1+$input{from_id}; $num=$#raz-$r; last RAZDEL;} } #} if ($center_tml) {require "design/$center_tml.tml";$center_design=$tml_design;} if ($center_tml_top) {require "design/$center_tml_top.tml";$center_design_top=$tml_design;} $center_design=~ s/<--id-->/$id/gi ; $center_design=~ s/<--sys_id-->/$num/gi ; $center_design_top=~ s/<--id-->/$id/gi ; $center_design_top=~ s/<--sys_id-->/$num/gi ; $top=~ s/<--id-->/$id/gi ; $top=~ s/<--sys_id-->/$num/gi ; $bottom=~ s/<--id-->/$id/gi ; $bottom=~ s/<--sys_id-->/$num/gi ; $avto_desk=$desk; $avto_desk=~s/<[\/\!]*?[^<>]*?>//g; $avto_desk=~s/\s+/ /g; $avto_desk=~ s/(.{200})(.*)/$1\.\./; $center_design=~ s/<--razdel-->/$name/gi ; $center_design=~ s/<--desk-->/$desk/gi ; $center_design=~ s/<--desk_mini-->/$avto_desk/gi ; $center_design_top=~ s/<--razdel-->/$name/gi ; $center_design_top=~ s/<--desk-->/$desk/gi ; $center_design_top=~ s/<--desk_mini-->/$avto_desk/gi ; $top=~ s/<--razdel-->/$name/gi ; $top=~ s/<--desk-->/$desk/gi ; $top=~ s/<--desk_mini-->/$avto_desk/gi ; $bottom=~ s/<--razdel-->/$name/gi ; $bottom=~ s/<--desk-->/$desk/gi ; $bottom=~ s/<--desk_mini-->/$avto_desk/gi ; @list=reverse(@list); if ($input{'type'} eq "add_pos") {print "Content-type: text/html\n\n"; print $top; &add_pos;} elsif ($input{'type'} eq "menu") { &catalog_menu;} elsif ($input{'type'} eq "nav") { &catalog_nav;} elsif ($input{'type'} eq "search") {print "Content-type: text/html\n\n"; print $top; &forma_search;} elsif ($input{'type'} eq "info") {&info;} elsif ($input{'type'} eq "razdel") {print "Content-type: text/html\n\n"; print $top; &show;} elsif ($input{'type'} eq "add") { if ($input{'name'} eq "" or $input{'message'} eq "") {print "Location: $http_referer?type=error\n\n";} else { &add; } } elsif ($input{'type'} eq "error") { print "Content-type: text/html\n\n"; print $top; &repeat; &forma;} elsif ($input{news}=~ /\d+/ ) { print "Content-type: text/html\n\n"; print $top; &news; } elsif ($input{'type'} eq "forma") { print "Content-type: text/html\n\n"; print $top; $review=$input{'review'}; &forma;} elsif ($input{'type'} eq "comments") { print "Content-type: text/html\n\n"; print $top; $review=$input{'review'}; if ( $button_place eq "end") { &comments; &forma; } elsif ( $button_place eq "link_high") { &link; &comments; } elsif ( $button_place eq "link_end") { &comments; &link; } elsif ( $button_place eq "high") { &forma; &comments; } else {&comments;} } elsif ($input{page}=~ /\d+/ ) { print "Content-type: text/html\n\n"; print $top; $from=$input{page}*$topics; if ($arhiv eq "on" & $arhiv_topics ne "") {$from=($input{page}-1)*$arhiv_topics+$topics; $main_topics=$topics; $topics=$arhiv_topics;} $to=$from+$topics; $page_num=$input{page}; print qq($center_design_top); &page if ($page_top_on eq "on"); &show_razdel; print qq($center_design); &page; if ($user_add_page eq "on") {print qq(

$user_add_text);} else {print qq(

$user_add_text); &add_pos;} } else {print "Content-type: text/html\n\n"; print $top; if ($input{type} eq "endpost") { if ($after_add_tml) {require "design/$after_add_tml.tml"; $after_add=$tml_design;} print qq($after_add); } # if ($base) { if ($arhiv) { $from=0; $to=$from+$topics; print qq($center_design_top); &show_razdel; print qq($center_design); print qq(
$arhiv_text
) if ($topics < @list); } else { $from=$input{page}*$topics; $to=$from+$topics; $page_num=0; print qq($center_design_top); &page if ($page_top_on eq "on"); &show_razdel; print qq($center_design); &page; } if ($user_add eq "on") { if ($user_add_page eq "on") {print qq(

$user_add_text);} else {print qq(

$user_add_text

); &add_pos;} } # } else {&show;} } sub catalog_nav { print "Content-type: text/html\n\n"; if ($input{news} ne "") { @list=reverse(@list); chomp $list[$input{news}]; ($date,$time,$date2,$time2,$data_pos,$user,$review,$foto,$foto2,$addcomm,$moder)=split(/::/,$list[$input{news}]); @data_base=split(/\|\^\|/,$data_pos); $nav_out = qq($data_base[1]); } if ($base) { %navrazd=(); opendir (DIR, "$servis"); @directory=readdir(DIR); foreach $file (@directory){ if ($file =~ /data/){ open (RA, "$servis/$file"); @temp_razd=; close (RA); $end=@temp_razd; for ($r=0;$r<$end;$r++) { ($base_num_tmp,$name_tmp,$desk_tmp)=split(/::/,$temp_razd[$r]); if ($base_num_tmp=~ /^\d+$/ ) { $from_base=$file; $from_base =~ s/data//; $from_base =~ s/.$ext//; $navrazd{$base_num_tmp}=qq($from_base|^|$name_tmp); } } } } &catalog_sub_nav; # print qq($description / $nav_out); } # else { print qq($description); } print qq($description / $nav_out); } sub catalog_sub_nav { ($from,$name)=split(/\|\^\|/,$navrazd{$base}); if ($url2_on) { $name=~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs; $tr_name=&totranslit($name); $tr_name=~ s/ /-/g; $link=qq(${topics_url}$tr_name-${base}\/); } else { $link=qq($topics_url?base=$base); } $nav_out = qq($name / $nav_out); if ($from) { $base=$from; &catalog_sub_nav;} } sub catalog_menu { print "Content-type: text/html\n\n"; if ($input{'java'} eq 1) { print qq(); } print qq( ); if ($input{base}) { $from=$input{base}; } if ($input{from}) { $from=$input{from}; } else { $from = ""; } $out="<--data${from}-->"; &catalog_sub_menu; print qq($out); print qq( ); } sub catalog_sub_menu { $n++; if ($n>999) {exit;} $file=qq(data${from}.${ext}); open (RA, "$servis/$file"); @temp_razd=; @temp_razd=reverse(@temp_razd); close (RA); $end=@temp_razd; $out_razd=""; $out_pos=""; $out_java=""; for ($r=0;$r<$end;$r++) { ($base_num_tmp,$name_tmp,$desk_tmp)=split(/::/,$temp_razd[$r]); $name_tmp=~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs; $tr_name=&totranslit($name_tmp); $tr_name=~ s/ /-/g; if ($base_num_tmp=~ /^\d+$/ ) { #link if ($url2_on) { $link=qq(${topics_url}$tr_name-${base_num_tmp}\/); } else { $link=qq($topics_url?base=$base_num_tmp); } #selected if ($base eq $base_num_tmp) { $sel=" class=selected"; } else {$sel="";} $out_razd.=qq( href="$link">$name_tmp<--data${base_num_tmp}-->\n); } else { ($date,$time,$date2,$time2,$data_pos,$user,$review,$foto,$foto2,$addcomm,$moder)=split(/::/,$temp_razd[$r]); if ($moder =~ "ok") { $pos_id=$end-$r-1; if ($url2_on) { if (${from}) { $link=qq(${topics_url}${from}\/${pos_id}.html); } else { $link=qq(${topics_url}${pos_id}.html); } } else {$link=qq($topics_url?base=${from}&news=$pos_id);} @data_base=split(/\|\^\|/,$data_pos); if ($pos_id eq $input{news} && $base eq $from) { $sel=" class=selected"; } else {$sel="";} $out_pos.=qq($data_base[1]\n); } } } if ($out_razd ne "" || $input{'item'} eq 1) { if ($n>1 && $base ne $from) {$dop_style=qq(style="display: none;");} else {$dop_style="";} $out_razd=qq(\n
    $out_razd$out_pos
\n); #java if ($input{'java'} eq 1) { $out_java=qq(class=submenu onclick="cat_changeDisplay('e_cat_menu${from}'); return false;");} } $out=~ s/<--data$from-->/$out_razd/; $out=~ s/<--java$from-->/$out_java/; if ($out =~ m/<--data(\d+)-->/g) { $from=$1; &catalog_sub_menu; } } sub forma_search { $search=$input{search}; print qq(
); $from=0; if ($search =~ m/.{3,}/) { print qq($center_design_top); &search; print qq($center_design);} else { print qq(Ошибка! Запрос должен быть не менее 3 символов.

); exit;} } sub search { opendir (DIR, "$servis"); @directory=readdir(DIR); foreach $file (@directory){ if ($file =~ /data/){ open (RA, "$servis/$file"); @temp_razd=; close (RA); undef @list; $base=$file; $base=~ s/(data)(\d+)(\.$ext)/$2/; @list=@temp_razd; @list=reverse(@list); $to=@list; &show_razdel; } } } sub show { if ($razdel_tml_top) {require "design/$razdel_tml_top.tml"; $razdel_top=$tml_design;} if ($razdel_tml_bot) {require "design/$razdel_tml_bot.tml"; $razdel_bot=$tml_design;} if ($input{dez} eq "2") { if ($razdel_tml_design2) {require "design/$razdel_tml_design2.tml"; $razdel_design2=$tml_design;} $razdel_design=$razdel_design2; } else { if ($razdel_tml_design) {require "design/$razdel_tml_design.tml"; $razdel_design=$tml_design;} } print $razdel_top; $end=@razd; for ($i=0;$i<$end;$i++) { chomp $list[$i]; ($base_num,$name,$desk)=split(/::/,$razd[$i]); &razdel_out; } print $razdel_bot; } sub razdel_out { $show=$razdel_design; $avto_desk=$desk; $avto_desk=~s/<[\/\!]*?[^<>]*?>//g; $avto_desk=~s/\s+/ /g; $avto_desk=~ s/(.{200})(.*)/$1\.\./; $show=~ s/<--desk_mini-->/$avto_desk/gi ; $show=~ s/<--razdel-->/$name/gi ; $show=~ s/<--name-->/$name/gi ; $show=~ s/<--desk-->/$desk/gi ; $id=$i+1+$input{from_id}; $num=$#list-$i; $show=~ s/<--id-->/$id/gi ; $show=~ s/<--sys_id-->/$num/gi ; $name=~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs; $name=~ s/\?//g; $tr_name=&totranslit($name); $tr_name=~ s/ /-/g; if ($url2_on) {$show=~ s/<--url-->/${topics_url}$tr_name-$base_num\//gi ;} else {$show=~ s/<--url-->/$topics_url?base=$base_num/gi ;} $show=~ s/<--info_link-->/$topics_url?type=info&id=$base_num/gi ; $show =~ s/(\b|\s|\()(http:\/\/[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show =~ s/(\s)(http:\/\/[\w,\-,\.,\/]+)(\s|
)/ $1
$2\<\/a\>$3/isg; $show =~ s/(\b|\s|\()(www\.[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show =~ s/(\s)(www\.[\w,\-,\.,\/]+)(\s|
)/
$2\<\/a\>$3/isg; $show =~ s/(\s)([\w,\-,\.]+\@[\w,\-,\.]+\.\w{2,3})/\ $2\<\/a\>/isg; print $show; } sub info { print "Content-type: text/html\n\n"; print $top; if ($razddesk_tml) {require "design/$razddesk_tml.tml"; $razddesk=$tml_design;} $show=$razddesk; $base=$input{'id'}; $razd_end=@razd; RAZDEL: for ($r=0;$r<$razd_end;$r++) { chomp $razd[$r]; ($base_num_tmp,$name_tmp,$desk_tmp)=split(/::/,$razd[$r]); if ($base eq $base_num_tmp) { $base_num=$base_num_tmp; $name=$name_tmp; $desk=$desk_tmp; last RAZDEL;} } $avto_desk=$desk; $avto_desk=~s/<[\/\!]*?[^<>]*?>//g; $avto_desk=~s/\s+/ /g; $avto_desk=~ s/(.{200})(.*)/$1\.\./; # $avto_desk=~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs; # $avto_desk=~ s/(.{200})(.*)/$1\.\./; $show=~ s/<--desk_mini-->/$avto_desk/gi ; $show=~ s/<--razdel-->/$name/gi ; $show=~ s/<--desk-->/$desk/gi ; if ($url2_on) {$show=~ s/<--url-->/${topics_url}$base\//gi ;} else {$show=~ s/<--url-->/$topics_url?base=$base/gi ;} print $show; } sub show_razdel { if ($topic_tml) {require "design/$topic_tml.tml"; $topic_design=$tml_design;} if ($topic2_tml) {require "design/$topic2_tml.tml"; $topic_design2=$tml_design;} if ($topic3_tml) {require "design/$topic3_tml.tml"; $topic_design3=$tml_design;} if ($razdel_tml_top) {require "design/$razdel_tml_top.tml"; $razdel_top=$tml_design;} if ($razdel_tml_bot) {require "design/$razdel_tml_bot.tml"; $razdel_bot=$tml_design;} if ($input{dez} eq "2") { if ($razdel_tml_design2) {require "design/$razdel_tml_design2.tml"; $razdel_design2=$tml_design;} $razdel_design=$razdel_design2; } else { if ($razdel_tml_design) {require "design/$razdel_tml_design.tml"; $razdel_design=$tml_design;} } if (@list<$to) {$to=@list;} SPISOK: for ($i=$from;$i<$to;$i++) { chomp $list[$i]; ($date,$time,$date2,$time2,$news,$user,$review,$foto,$foto2,$addcomm,$moder)=split(/::/,$list[$i]); if ($date =~ m/\./i) { if ($input{type} eq "search") {if ($news !~ /$search/i){next SPISOK;} } &position_out; } elsif ($input{type} ne "search") {($base_num,$name,$desk)=split("::",$list[$i]); &razdel_out;} } } sub position_out { @base=split(/\|\^\|/,$news); @massiv=split("\@",$fields_name); if ($moder eq "wait") {next SPISOK;} ($d,$m,$y)=split(/\./,$date); ($h,$minut)=split(/:/,$time); $nowtime="$year$months[$mon]$mday$hour$min"; $posttime="$y$m$d$h$minut"; if ($posttime > $nowtime) {next SPISOK;} if ($date2 ne "" & ($input{page} eq "" or $date_in_arhiv ne "on")) { ($d2,$m2,$y2)=split(/\./,$date2); ($h2,$minut2)=split(/:/,$time2); $endtime="$y2$m2$d2$h2$minut2"; if ($endtime <= $nowtime) {$to++; next SPISOK;} } if ($dez eq "1" or $dez eq "") {$show=$topic_design; $dez=2;} elsif ($topic_design2 ne "" & $dez eq "2") {$show=$topic_design2; $dez=3;} elsif ($topic_design3 ne "" & $dez eq "3") {$show=$topic_design3; $dez=1;} else {$show=$topic_design; $dez=2;} if ($input{dez} eq "2") { if ($razdel_tml_design2) {require "design/$razdel_tml_design2.tml"; $razdel_design2=$tml_design;} $show=$razdel_design2; } for ($n=0;$n<@users;$n++) { ($login,$pass,$status,$usermail)=split(/::/,$users[$n]); if ($login =~ "$user") { $user="$user<\/a>";} } if ($input{'base'} ne "" && $input{'base'} ne "last") { open (DATA, "<$servis/comments/$review.cnt"); $count=; close (DATA); $count="0" if (!$count); } open (REVIEW, "$servis/comments/$review.$ext"); @comments=; close (REVIEW); $number=$#comments; $number++; $number="0" if ($number eq 0 or $addcomm ne "on"); if ($op_num) { $base[$op_field] =~ s/\,/\./g; $op_num =~ s/\,/\./g; if ($op_op eq "umn") {$base[$op_field]=$base[$op_field]*$op_num;} if ($op_op eq "del") {$base[$op_field]=$base[$op_field]/$op_num;} if ($op_op eq "plus") {$base[$op_field]=$base[$op_field]+$op_num;} if ($op_op eq "minus") {$base[$op_field]=$base[$op_field]-$op_num;} } for ($f=0;$f<$fields;$f++) {$fil=$f+1; if ($base[$fil] ne "") { $show=~ s/<--$fil-->/$base[$fil]/gi; $show=~ s/<--$fil-->/$base[$fil]/gi; $kratko=$base[$fil]; $kratko=~s/<[\/\!]*?[^<>]*?>//g; $kratko=~s/\s+/ /g; $kratko=~ s/(.{300})(.*)/$1\.\./; $show=~ s/<--${fil}_mini-->/$kratko/gi; } else { $show=~ s/<--$fil-->//gi; $show=~ s/<--${fil}_mini-->//gi; } if ($base[$fil] ne "") {$show=~ s/<--name$fil-->/$massiv[$f]/gi; } else {$show=~ s/<--name$fil-->//gi;} } $show=~ s/<--name-->/$base[1]/gi ; if ($name) {$show=~ s/<--razdel-->/$name/gi ;} else {$show=~ s/<--razdel-->/$base[1]/gi ;} $show=~ s/<--date-->/$date/gi ; $show=~ s/<--time-->/$time/gi ; $show=~ s/<--date2-->/$date2/gi ; $show=~ s/<--time2-->/$time2/gi ; $show=~ s/<--user-->/$user/gi ; $show=~ s/<--number-->/$number/gi ; $show=~ s/<--count-->/$count/gi ; $id=$i+1+$input{from_id}; $num=$#list-$i; $show=~ s/<--id-->/$id/gi ; $show=~ s/<--sys_id-->/$num/gi ; if ($foto) { $show=~ s/<--foto-->/$upload\/$servis\/$foto/gi ; $show=~ s/<--foto_mini-->/$upload\/$servis\/mini_$foto/gi ; $show=~ s/<--foto_url-->/$upload\/$servis\/$foto/gi ; $show=~ s/<--foto_name-->/$upload\/$servis\/$foto/gi ; } else { $show=~ s/<--foto-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto_mini-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto_url-->/\#/gi ; $show=~ s/<--foto_name-->//gi ; } if ($foto2) { $show=~ s/<--foto2-->/$upload\/$servis\/$foto2/gi ; $show=~ s/<--foto2_mini-->/$upload\/$servis\/mini_$foto2/gi; $show=~ s/<--foto2_url-->/$upload\/$servis\/$foto2/gi ; $show=~ s/<--foto2_name-->/$upload\/$servis\/$foto2/gi ; } else { $show=~ s/<--foto2-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto2_mini-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto2_url-->/\#/gi ; $show=~ s/<--foto2_name-->//gi ; } if ($url2_on) { if (${base}) { $show=~ s/<--url-->/${topics_url}${base}\/$num.html/gi ; } else { $show=~ s/<--url-->/${topics_url}${num}.html/gi ; } } else {$show=~ s/<--url-->/$topics_url?base=$base&news=$num/gi ;} $show =~ s/(\b|\s|\()(http:\/\/[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show =~ s/(\s)(http:\/\/[\w,\-,\.,\/]+)(\s|
)/ $1
$2\<\/a\>$3/isg; $show =~ s/(\b|\s|\()(www\.[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show =~ s/(\s)(www\.[\w,\-,\.,\/]+)(\s|
)/
$2\<\/a\>$3/isg; $show =~ s/(\s)([\w,\-,\.]+\@[\w,\-,\.]+\.\w{2,3})/\ $2\<\/a\>/isg; print $show; } sub news { @list=reverse(@list); if ($news_tml) {require "design/$news_tml.tml"; $news_design=$tml_design;} $show=$news_design; chomp $list[$input{news}]; ($date,$time,$date2,$time2,$news,$user,$review,$foto,$foto2,$addcomm,$moder)=split(/::/,$list[$input{news}]); @base=split(/\|\^\|/,$news); @massiv=split("\@",$fields_name); exit if ($moder eq "wait"); ($d,$m,$y)=split(/\./,$date); ($h,$minut)=split(/:/,$time); $nowtime="$year$months[$mon]$mday$hour$min"; $posttime="$y$m$d$h$minut"; if ($posttime > $nowtime) {exit;} open (DATA, "<$servis/comments/$review.cnt"); $count=; close (DATA); $count++; open (DATA, ">$servis/comments/$review.cnt"); █ print DATA $count; &unblock; close (DATA); for ($n=0;$n<@users;$n++) { ($login,$pass,$status,$usermail)=split(/::/,$users[$n]); if ($login =~ "$user") { $user="$user<\/a>";} } for ($f=0;$f<$fields;$f++) { $fil=$f+1; $show=~ s/<--$fil-->/$base[$fil]/gi ; $kratko=$base[$fil]; $kratko=~s/<[\/\!]*?[^<>]*?>//g; $kratko=~s/\s+/ /g; $kratko=~ s/(.{300})(.*)/$1\.\./; $show=~ s/<--${fil}_mini-->/$kratko/gi; } for ($f=0;$f<$fields;$f++) {$fil=$f+1; if ($base[$fil] ne "") {$show=~ s/<--name$fil-->/$massiv[$f]/gi; } else {$show=~ s/<--name$fil-->//gi;} } $show=~ s/<--razdel-->/$name/gi ; $show=~ s/<--desk-->/$desk/gi ; $show=~ s/<--date-->/$date/gi ; $show=~ s/<--time-->/$time/gi ; $show=~ s/<--date2-->/$date2/gi ; $show=~ s/<--time2-->/$time2/gi ; $show=~ s/<--user-->/$user/gi ; $show=~ s/<--number-->/$number/gi ; $show=~ s/<--count-->/$count/gi ; if ($foto) { $show=~ s/<--foto-->/$upload\/$servis\/$foto/gi ; $show=~ s/<--foto_mini-->/$upload\/$servis\/mini_$foto/gi ; $show=~ s/<--foto_url-->/$upload\/$servis\/$foto/gi ; $show=~ s/<--foto_name-->/$upload\/$servis\/$foto/gi ; } else { $show=~ s/<--foto-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto_mini-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto_url-->/\#/gi ; $show=~ s/<--foto_name-->//gi ; } if ($foto2) { $show=~ s/<--foto2-->/$upload\/$servis\/$foto2/gi ; $show=~ s/<--foto2_mini-->/$upload\/$servis\/mini_$foto2/gi ; $show=~ s/<--foto2_url-->/$upload\/$servis\/$foto2/gi ; $show=~ s/<--foto2_name-->/$upload\/$servis\/$foto2/gi ; } else { $show=~ s/<--foto2-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto2_mini-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto2_url-->/\#/gi ; $show=~ s/<--foto2_name-->//gi ; } $num=$#list-$i; if ($url2_on) { if (${base}) { $show=~ s/<--url-->/${topics_url}${base}\/$input{news}.html/gi ; } else { $show=~ s/<--url-->/${topics_url}$input{news}.html/gi ; } } else {$show=~ s/<--url-->/$topics_url?base=$base&news=$input{news}/gi;} $show=~ s/<--link-->/$cgi\/$servis.$ext?base=$base&news=$input{news}/gi ; $show =~ s/(\b|\s|\()(http:\/\/[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show =~ s/(\s)(http:\/\/[\w,\-,\.,\/]+)(\s|
)/ $1
$2\<\/a\>$3/isg; $show =~ s/(\b|\s|\()(www\.[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show =~ s/(\s)(www\.[\w,\-,\.,\/]+)(\s|
)/
$2\<\/a\>$3/isg; $show =~ s/(\s)([\w,\-,\.]+\@[\w,\-,\.]+\.\w{2,3})/ $2\<\/a\>/isg; print $show; close (DATA); if ($comments_on eq "on" & $addcomm eq "on") { if ( $comments_place eq "out") { &comments_link; exit;} if ( $button_place eq "end") { &comments; &forma; } elsif ( $button_place eq "link_high") { &link; &comments; } elsif ( $button_place eq "link_end") { &comments; &link; } elsif ( $button_place eq "high") { &forma; &comments; } else {&comments;} } } sub comments { if ($comm_tml) {require "design/$comm_tml.tml"; $comment_design=$tml_design;} print qq(
$comments_text:

); open (REVIEW, "$servis/comments/$review.$ext"); @comments=; close (REVIEW); @comments=reverse(@comments) if ($comments_sort eq "last_top"); $page=$input{'com_page'}; if ($page eq "") {$page=1;} $from=($page-1)*$kolvo_com; $to=$page*$kolvo_com; if (@comments<$to) {$to=@comments;} for ($m=$from;$m<$to;$m++) { chomp $comments[$m]; ($date2,$time2,$comment,$name,$email2,$ip)=split(/::/,$comments[$m]); if ($email2 ne "") { $name="
$name<\/a>";} $show2=$comment_design; $show2=~ s/<--date-->/$date2/gi ; $show2=~ s/<--time-->/$time2/gi ; $show2=~ s/<--name-->/$name/gi ; $show2=~ s/<--comment-->/$comment/gi ; $show2=~ s/<--ip-->/$ip/gi ; $show2 =~ s/(\b|\s|\()(http:\/\/[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show2 =~ s/(\s)(http:\/\/[\w,\-,\.,\/]+)(\s|
)/ $1
$2\<\/a\>$3/isg; $show2 =~ s/(\b|\s|\()(www\.[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show2 =~ s/(\s)(www\.[\w,\-,\.,\/]+)(\s|
)/
$2\<\/a\>$3/isg; $show2 =~ s/(\s)([\w,\-,\.]+\@[\w,\-,\.]+\.\w{2,3})/ $2\<\/a\>/isg; print $show2; } &com_page; } sub com_page { $kolvo_pages=@comments/$kolvo_com; if ($kolvo_pages =~ /(\d+)\.(\d+)/) { $kolvo_pages=$1; $kolvo_pages++; } $page=$input{'com_page'}; if ($page eq "") {$page=1;} for ($i=1; $i<$page; $i++) {print qq( [$i] );} print qq( [$page]) if ($kolvo_pages>1); $i=1; for ($i+=$page; $i<=$kolvo_pages; $i++) {print qq( [$i]);} print qq(   Всего: ); print $#comments+1; } sub page { $vsego=@list-$topics; if ($arhiv eq "on" & $arhiv_topics ne "") {$vsego=@list-$main_topics;} $kolvo_pages=($#list)/$topics; if ($arhiv) {$go=1;} else {$go=0;} for ($i=$go; $i<$page_num; $i++) { $num=$i; $num++ if ($arhiv ne "on"); if ($url2_on) { if ($i eq "0") {$page_link=qq([$num]);} else { $page_link=qq([$num]); } } else {$page_link=qq([$num]);} print qq( $page_link ); } $num=$page_num; $num++ if ($arhiv ne "on"); print qq( [$num]) if ($kolvo_pages>=1); $i=1; for ($i+=$page_num; $i<=$kolvo_pages; $i++) {$num=$i; $num++ if ($arhiv ne "on"); if ($url2_on) {$page_link=qq([$num]);} else {$page_link=qq([$num]);} print qq( $page_link ); } if ($kolvo_on eq "on") { print qq(   Всего: ); if ($arhiv) {print $vsego;} else {print $#list+1;} } } sub add_pos { &cookie; if ($user_add eq "on") { if ($base eq "") {$base=0;} $rn=rand 999999; $img_code=sprintf "%.f", $rn; if ($ENV{'HTTP_X_FORWARDED_FOR'} ne "") {$ip=$ENV{'HTTP_X_FORWARDED_FOR'};} else {$ip=$ENV{'REMOTE_ADDR'};} $sec_code=crypt($img_code,$ip); ($s1,$s2,$s3,$s4,$s5,$s6)=split(//,$img_code); print qq(
Автор:
E-mail:
); @massiv=split("\@",$fields_name); for ($f=0;$f<$fields;$f++) {print qq( $massiv[$f]:

\n );} if ($load_foto1 eq "on") { print qq(Прикрепить файл:
); print qq((размер не более $foto1_size кб)
) if ($foto1_size); } if ($load_foto2 eq "on") { print qq(Прикрепить файл:

); print qq((размер не более $foto2_size кб)
) if ($foto2_size); } print qq(Перед отправкой введите код :
) if ($sec_code_on); print qq(
); } } sub add { if ( $button_place ne "none") { if ($ENV{'HTTP_X_FORWARDED_FOR'} ne "") {$ip=$ENV{'HTTP_X_FORWARDED_FOR'};} else {$ip=$ENV{'REMOTE_ADDR'};} if ($sec_code_on) { $sec_code=crypt($input{'img_code'},$ip); if ($sec_code ne "$input{'temp_code'}") {print "Content-type: text/html\n\n"; print $top; print qq(Вы ввели неверный код); print $bottom; die;} } $message=$input{'message'}; $message=~ s/(\S{50,})//gi; $name=$input{'name'}; $name=~ s/(\S{50,})//gi; $email=$input{'email'}; $email=~ s/(\S{50,})//gi; if ($email =~ /\=/) {print "Content-type: text/html\n\n"; print $top; print qq(Неверный e-mail); print $bottom; die;} $review=$input{'review'}; open (DATA, ">>$servis/comments/$review.$ext"); █ print DATA "$date1\:\:$time1\:\:$message \:\:$name\:\:$email\:\:$ip\n"; &unblock; close (DATA); #---------------------Установка Cookies и открытие главной страницы------- print "Set-Cookie: name=$name; expires=Friday,31-Dec-2090 23:59:59 GMT; path=/; domain=$domen;\n"; print "Set-Cookie: email=$email; expires=Friday,31-Dec-2090 23:59:59 GMT; path=/; domain=$domen;\n"; $http_referer=$input{'go'} if ($button_place eq "link_high" or $button_place eq "link_end"); } print "Location: $http_referer\n\n"; } sub repeat { #Если заполнены не все поля (и ява выключена) print qq(
Поля Имя и Комментарий являются обязательными для заполнения.
Пожалуйста, заполните их. ); } sub forma { &cookie; #-----------------------Рисуем форму--------------- $rn=rand 999999; $img_code=sprintf "%.f", $rn; if ($ENV{'HTTP_X_FORWARDED_FOR'} ne "") {$ip=$ENV{'HTTP_X_FORWARDED_FOR'};} else {$ip=$ENV{'REMOTE_ADDR'};} $sec_code=crypt($img_code,$ip); ($s1,$s2,$s3,$s4,$s5,$s6)=split(//,$img_code); print qq(
Добавить комментарий
Имя
E-mail:
Комментарий:

); print qq(Перед отправкой введите код :
) if ($sec_code_on); print qq(

); } sub link { $link=$ENV{'DOCUMENT_URI'}; $link=$topics_url if ($topics_url); $link=$news_url if ($news_url); print qq(

$button_text

); } sub comments_link { $link=$ENV{'DOCUMENT_URI'}; $link=$topics_url if ($topics_url); $link=$news_url if ($news_url); print qq(

$comments_text

); } print $bottom if ($input{'type'} ne "menu"); undef $v; exit;

#!/usr/bin/perl #===================================================== # Система управления контентом Reactor #----------------------------------------------------- # http://www.reart.ru/ #----------------------------------------------------- # Данный программный код разработан и принадлежит # ООО "Реарт" г. Владимир. Он НЕ является свободно # распространяемым и НЕ бесплатным. Запрещена любая # модификация и распространение кода без согласования # с компанией Реарт. #----------------------------------------------------- # Дата установки системы: 03.02.2017 #----------------------------------------------------- # Copyright (c) 2001-2017 Компания Реарт #===================================================== # Переменные передаваемые скрипту при выводе меню каталога ?type=menu # from= номер базы, с которой начнет строится меню # java=1 меню раскрывается безе перезагрузки с помощью javascript # item=1 показывать в меню не только разделы, но и позиции # По-умолчанию в меню выводятся только разделы и если вместе с разделами идут позиции, то выводятся и они # После переменных можно вставлять &$QUERY_STRING тогда текущий раздел и позиция будут иметь класс selected $servis=$ENV{'SCRIPT_FILENAME'}; $servis=~ s/(\S+\/)(\w+)(\.\w+)/$2/; require "setup.cgi"; require "$servis/cfg.$ext"; if ($base ne "") {$servis=$base;} $config="$servis/cfg.$ext"; $users="admin/users.$ext"; require "lib.$ext"; @months = ('01','02','03','04','05','06','07','08','09','10','11','12'); @days = ('Вс','Пн','Вт','Ср','Чт','Пт','Сб'); ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime(time); if ($min =~/\d\d/) {$min="$min";} else {$min="0$min";} if ($hour =~/\d\d/) {$hour="$hour";} else {$hour="0$hour";} if ($mday =~/\d\d/) {$mday="$mday";} else {$mday="0$mday";} $year+=1900; $date1=qq($mday.$months[$mon].$year); $time1=qq($hour:$min); open (USERS, "$users"); @users=; close (USERS); read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); if (!$buffer) { $buffer=$ENV{'QUERY_STRING'}; } $http_referer=$ENV{'HTTP_REFERER'}; @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; $value =~ s//>/g; $value =~ s/\n\n/
/g; $value =~ s/\r\n/
/g; $value =~ s/\n/
/g; $value =~ s/\cM//g; $input{$name} = $value; } if ($input{info} eq "name") { print "Content-type: text/html\n\n"; print $description; exit; } if ($input{'base'} ne "" && $input{'base'} ne "last") { $base=$input{'base'}; $razdels="$servis/data$base.$ext"; $data="$servis/data$base.$ext"; } else {$razdels="$servis/data.$ext"; $base=""; $data="$servis/data.$ext";} open (RAZDELS, "$razdels"); @razd=; close (RAZDELS); @razd=reverse(@razd); if ($input{'base'} eq "last") { ($base)=split(/::/,$razd[0]); $razdels="$servis/data$base.$ext"; $data="$servis/data$base.$ext"; open (RAZDELS, "$razdels"); @razd=; close (RAZDELS); @razd=reverse(@razd); } open (DATA, "$data"); @list=; close (DATA); if ($input{news} eq "last" ) {$input{news}=$#list;} if ($input{news} eq "random" ) { $kolvo_pos=@list; $rn=rand $kolvo_pos; $input{news}=sprintf "%u", $rn; } if ($top_tml) {require "design/$top_tml.tml"; $top=$tml_design;} if ($top2_tml) {require "design/$top2_tml.tml"; $top2=$tml_design;} if ($bottom_tml) {require "design/$bottom_tml.tml"; $bottom=$tml_design;} if ($bottom2_tml) {require "design/$bottom2_tml.tml"; $bottom2=$tml_design;} $top=qq($top$top2); $bottom=qq($bottom$bottom2); if ($design_on) {$top=qq($main_top$top); $bottom=qq($bottom$main_bottom);} #if ($center_design ne "" or $center_design_top ne "" or $center_tml ne "" or $center_tml_top ne "") { #Читаем data файл, дабы поиметь описание разделов opendir (DIR, "$servis"); @directory=readdir(DIR); foreach $file (@directory){ if ($file =~ /data/){ open (RA, "$servis/$file"); @temp_razd=; close (RA); push (@raz, @temp_razd); } } $razd_end=@raz; $name=""; RAZDEL: for ($r=0;$r<$razd_end;$r++) { chomp $raz[$r]; ($base_num_tmp,$name_tmp,$desk_tmp)=split(/::/,$raz[$r]); if ($base eq $base_num_tmp) { $base_num=$base_num_tmp; $name=$name_tmp; $desk=$desk_tmp; $id=$r+1+$input{from_id}; $num=$#raz-$r; last RAZDEL;} } #} if ($center_tml) {require "design/$center_tml.tml";$center_design=$tml_design;} if ($center_tml_top) {require "design/$center_tml_top.tml";$center_design_top=$tml_design;} $center_design=~ s/<--id-->/$id/gi ; $center_design=~ s/<--sys_id-->/$num/gi ; $center_design_top=~ s/<--id-->/$id/gi ; $center_design_top=~ s/<--sys_id-->/$num/gi ; $top=~ s/<--id-->/$id/gi ; $top=~ s/<--sys_id-->/$num/gi ; $bottom=~ s/<--id-->/$id/gi ; $bottom=~ s/<--sys_id-->/$num/gi ; $avto_desk=$desk; $avto_desk=~s/<[\/\!]*?[^<>]*?>//g; $avto_desk=~s/\s+/ /g; $avto_desk=~ s/(.{200})(.*)/$1\.\./; $center_design=~ s/<--razdel-->/$name/gi ; $center_design=~ s/<--desk-->/$desk/gi ; $center_design=~ s/<--desk_mini-->/$avto_desk/gi ; $center_design_top=~ s/<--razdel-->/$name/gi ; $center_design_top=~ s/<--desk-->/$desk/gi ; $center_design_top=~ s/<--desk_mini-->/$avto_desk/gi ; $top=~ s/<--razdel-->/$name/gi ; $top=~ s/<--desk-->/$desk/gi ; $top=~ s/<--desk_mini-->/$avto_desk/gi ; $bottom=~ s/<--razdel-->/$name/gi ; $bottom=~ s/<--desk-->/$desk/gi ; $bottom=~ s/<--desk_mini-->/$avto_desk/gi ; @list=reverse(@list); if ($input{'type'} eq "add_pos") {print "Content-type: text/html\n\n"; print $top; &add_pos;} elsif ($input{'type'} eq "menu") { &catalog_menu;} elsif ($input{'type'} eq "nav") { &catalog_nav;} elsif ($input{'type'} eq "search") {print "Content-type: text/html\n\n"; print $top; &forma_search;} elsif ($input{'type'} eq "info") {&info;} elsif ($input{'type'} eq "razdel") {print "Content-type: text/html\n\n"; print $top; &show;} elsif ($input{'type'} eq "add") { if ($input{'name'} eq "" or $input{'message'} eq "") {print "Location: $http_referer?type=error\n\n";} else { &add; } } elsif ($input{'type'} eq "error") { print "Content-type: text/html\n\n"; print $top; &repeat; &forma;} elsif ($input{news}=~ /\d+/ ) { print "Content-type: text/html\n\n"; print $top; &news; } elsif ($input{'type'} eq "forma") { print "Content-type: text/html\n\n"; print $top; $review=$input{'review'}; &forma;} elsif ($input{'type'} eq "comments") { print "Content-type: text/html\n\n"; print $top; $review=$input{'review'}; if ( $button_place eq "end") { &comments; &forma; } elsif ( $button_place eq "link_high") { &link; &comments; } elsif ( $button_place eq "link_end") { &comments; &link; } elsif ( $button_place eq "high") { &forma; &comments; } else {&comments;} } elsif ($input{page}=~ /\d+/ ) { print "Content-type: text/html\n\n"; print $top; $from=$input{page}*$topics; if ($arhiv eq "on" & $arhiv_topics ne "") {$from=($input{page}-1)*$arhiv_topics+$topics; $main_topics=$topics; $topics=$arhiv_topics;} $to=$from+$topics; $page_num=$input{page}; print qq($center_design_top); &page if ($page_top_on eq "on"); &show_razdel; print qq($center_design); &page; if ($user_add_page eq "on") {print qq(

$user_add_text);} else {print qq(

$user_add_text); &add_pos;} } else {print "Content-type: text/html\n\n"; print $top; if ($input{type} eq "endpost") { if ($after_add_tml) {require "design/$after_add_tml.tml"; $after_add=$tml_design;} print qq($after_add); } # if ($base) { if ($arhiv) { $from=0; $to=$from+$topics; print qq($center_design_top); &show_razdel; print qq($center_design); print qq(
$arhiv_text
) if ($topics < @list); } else { $from=$input{page}*$topics; $to=$from+$topics; $page_num=0; print qq($center_design_top); &page if ($page_top_on eq "on"); &show_razdel; print qq($center_design); &page; } if ($user_add eq "on") { if ($user_add_page eq "on") {print qq(

$user_add_text);} else {print qq(

$user_add_text

); &add_pos;} } # } else {&show;} } sub catalog_nav { print "Content-type: text/html\n\n"; if ($input{news} ne "") { @list=reverse(@list); chomp $list[$input{news}]; ($date,$time,$date2,$time2,$data_pos,$user,$review,$foto,$foto2,$addcomm,$moder)=split(/::/,$list[$input{news}]); @data_base=split(/\|\^\|/,$data_pos); $nav_out = qq($data_base[1]); } if ($base) { %navrazd=(); opendir (DIR, "$servis"); @directory=readdir(DIR); foreach $file (@directory){ if ($file =~ /data/){ open (RA, "$servis/$file"); @temp_razd=; close (RA); $end=@temp_razd; for ($r=0;$r<$end;$r++) { ($base_num_tmp,$name_tmp,$desk_tmp)=split(/::/,$temp_razd[$r]); if ($base_num_tmp=~ /^\d+$/ ) { $from_base=$file; $from_base =~ s/data//; $from_base =~ s/.$ext//; $navrazd{$base_num_tmp}=qq($from_base|^|$name_tmp); } } } } &catalog_sub_nav; # print qq($description / $nav_out); } # else { print qq($description); } print qq($description / $nav_out); } sub catalog_sub_nav { ($from,$name)=split(/\|\^\|/,$navrazd{$base}); if ($url2_on) { $name=~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs; $tr_name=&totranslit($name); $tr_name=~ s/ /-/g; $link=qq(${topics_url}$tr_name-${base}\/); } else { $link=qq($topics_url?base=$base); } $nav_out = qq($name / $nav_out); if ($from) { $base=$from; &catalog_sub_nav;} } sub catalog_menu { print "Content-type: text/html\n\n"; if ($input{'java'} eq 1) { print qq(); } print qq( ); if ($input{base}) { $from=$input{base}; } if ($input{from}) { $from=$input{from}; } else { $from = ""; } $out="<--data${from}-->"; &catalog_sub_menu; print qq($out); print qq( ); } sub catalog_sub_menu { $n++; if ($n>999) {exit;} $file=qq(data${from}.${ext}); open (RA, "$servis/$file"); @temp_razd=; @temp_razd=reverse(@temp_razd); close (RA); $end=@temp_razd; $out_razd=""; $out_pos=""; $out_java=""; for ($r=0;$r<$end;$r++) { ($base_num_tmp,$name_tmp,$desk_tmp)=split(/::/,$temp_razd[$r]); $name_tmp=~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs; $tr_name=&totranslit($name_tmp); $tr_name=~ s/ /-/g; if ($base_num_tmp=~ /^\d+$/ ) { #link if ($url2_on) { $link=qq(${topics_url}$tr_name-${base_num_tmp}\/); } else { $link=qq($topics_url?base=$base_num_tmp); } #selected if ($base eq $base_num_tmp) { $sel=" class=selected"; } else {$sel="";} $out_razd.=qq( href="$link">$name_tmp<--data${base_num_tmp}-->\n); } else { ($date,$time,$date2,$time2,$data_pos,$user,$review,$foto,$foto2,$addcomm,$moder)=split(/::/,$temp_razd[$r]); if ($moder =~ "ok") { $pos_id=$end-$r-1; if ($url2_on) { if (${from}) { $link=qq(${topics_url}${from}\/${pos_id}.html); } else { $link=qq(${topics_url}${pos_id}.html); } } else {$link=qq($topics_url?base=${from}&news=$pos_id);} @data_base=split(/\|\^\|/,$data_pos); if ($pos_id eq $input{news} && $base eq $from) { $sel=" class=selected"; } else {$sel="";} $out_pos.=qq($data_base[1]\n); } } } if ($out_razd ne "" || $input{'item'} eq 1) { if ($n>1 && $base ne $from) {$dop_style=qq(style="display: none;");} else {$dop_style="";} $out_razd=qq(\n
    $out_razd$out_pos
\n); #java if ($input{'java'} eq 1) { $out_java=qq(class=submenu onclick="cat_changeDisplay('e_cat_menu${from}'); return false;");} } $out=~ s/<--data$from-->/$out_razd/; $out=~ s/<--java$from-->/$out_java/; if ($out =~ m/<--data(\d+)-->/g) { $from=$1; &catalog_sub_menu; } } sub forma_search { $search=$input{search}; print qq(
); $from=0; if ($search =~ m/.{3,}/) { print qq($center_design_top); &search; print qq($center_design);} else { print qq(Ошибка! Запрос должен быть не менее 3 символов.

); exit;} } sub search { opendir (DIR, "$servis"); @directory=readdir(DIR); foreach $file (@directory){ if ($file =~ /data/){ open (RA, "$servis/$file"); @temp_razd=; close (RA); undef @list; $base=$file; $base=~ s/(data)(\d+)(\.$ext)/$2/; @list=@temp_razd; @list=reverse(@list); $to=@list; &show_razdel; } } } sub show { if ($razdel_tml_top) {require "design/$razdel_tml_top.tml"; $razdel_top=$tml_design;} if ($razdel_tml_bot) {require "design/$razdel_tml_bot.tml"; $razdel_bot=$tml_design;} if ($input{dez} eq "2") { if ($razdel_tml_design2) {require "design/$razdel_tml_design2.tml"; $razdel_design2=$tml_design;} $razdel_design=$razdel_design2; } else { if ($razdel_tml_design) {require "design/$razdel_tml_design.tml"; $razdel_design=$tml_design;} } print $razdel_top; $end=@razd; for ($i=0;$i<$end;$i++) { chomp $list[$i]; ($base_num,$name,$desk)=split(/::/,$razd[$i]); &razdel_out; } print $razdel_bot; } sub razdel_out { $show=$razdel_design; $avto_desk=$desk; $avto_desk=~s/<[\/\!]*?[^<>]*?>//g; $avto_desk=~s/\s+/ /g; $avto_desk=~ s/(.{200})(.*)/$1\.\./; $show=~ s/<--desk_mini-->/$avto_desk/gi ; $show=~ s/<--razdel-->/$name/gi ; $show=~ s/<--name-->/$name/gi ; $show=~ s/<--desk-->/$desk/gi ; $id=$i+1+$input{from_id}; $num=$#list-$i; $show=~ s/<--id-->/$id/gi ; $show=~ s/<--sys_id-->/$num/gi ; $name=~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs; $name=~ s/\?//g; $tr_name=&totranslit($name); $tr_name=~ s/ /-/g; if ($url2_on) {$show=~ s/<--url-->/${topics_url}$tr_name-$base_num\//gi ;} else {$show=~ s/<--url-->/$topics_url?base=$base_num/gi ;} $show=~ s/<--info_link-->/$topics_url?type=info&id=$base_num/gi ; $show =~ s/(\b|\s|\()(http:\/\/[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show =~ s/(\s)(http:\/\/[\w,\-,\.,\/]+)(\s|
)/ $1
$2\<\/a\>$3/isg; $show =~ s/(\b|\s|\()(www\.[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show =~ s/(\s)(www\.[\w,\-,\.,\/]+)(\s|
)/
$2\<\/a\>$3/isg; $show =~ s/(\s)([\w,\-,\.]+\@[\w,\-,\.]+\.\w{2,3})/\ $2\<\/a\>/isg; print $show; } sub info { print "Content-type: text/html\n\n"; print $top; if ($razddesk_tml) {require "design/$razddesk_tml.tml"; $razddesk=$tml_design;} $show=$razddesk; $base=$input{'id'}; $razd_end=@razd; RAZDEL: for ($r=0;$r<$razd_end;$r++) { chomp $razd[$r]; ($base_num_tmp,$name_tmp,$desk_tmp)=split(/::/,$razd[$r]); if ($base eq $base_num_tmp) { $base_num=$base_num_tmp; $name=$name_tmp; $desk=$desk_tmp; last RAZDEL;} } $avto_desk=$desk; $avto_desk=~s/<[\/\!]*?[^<>]*?>//g; $avto_desk=~s/\s+/ /g; $avto_desk=~ s/(.{200})(.*)/$1\.\./; # $avto_desk=~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs; # $avto_desk=~ s/(.{200})(.*)/$1\.\./; $show=~ s/<--desk_mini-->/$avto_desk/gi ; $show=~ s/<--razdel-->/$name/gi ; $show=~ s/<--desk-->/$desk/gi ; if ($url2_on) {$show=~ s/<--url-->/${topics_url}$base\//gi ;} else {$show=~ s/<--url-->/$topics_url?base=$base/gi ;} print $show; } sub show_razdel { if ($topic_tml) {require "design/$topic_tml.tml"; $topic_design=$tml_design;} if ($topic2_tml) {require "design/$topic2_tml.tml"; $topic_design2=$tml_design;} if ($topic3_tml) {require "design/$topic3_tml.tml"; $topic_design3=$tml_design;} if ($razdel_tml_top) {require "design/$razdel_tml_top.tml"; $razdel_top=$tml_design;} if ($razdel_tml_bot) {require "design/$razdel_tml_bot.tml"; $razdel_bot=$tml_design;} if ($input{dez} eq "2") { if ($razdel_tml_design2) {require "design/$razdel_tml_design2.tml"; $razdel_design2=$tml_design;} $razdel_design=$razdel_design2; } else { if ($razdel_tml_design) {require "design/$razdel_tml_design.tml"; $razdel_design=$tml_design;} } if (@list<$to) {$to=@list;} SPISOK: for ($i=$from;$i<$to;$i++) { chomp $list[$i]; ($date,$time,$date2,$time2,$news,$user,$review,$foto,$foto2,$addcomm,$moder)=split(/::/,$list[$i]); if ($date =~ m/\./i) { if ($input{type} eq "search") {if ($news !~ /$search/i){next SPISOK;} } &position_out; } elsif ($input{type} ne "search") {($base_num,$name,$desk)=split("::",$list[$i]); &razdel_out;} } } sub position_out { @base=split(/\|\^\|/,$news); @massiv=split("\@",$fields_name); if ($moder eq "wait") {next SPISOK;} ($d,$m,$y)=split(/\./,$date); ($h,$minut)=split(/:/,$time); $nowtime="$year$months[$mon]$mday$hour$min"; $posttime="$y$m$d$h$minut"; if ($posttime > $nowtime) {next SPISOK;} if ($date2 ne "" & ($input{page} eq "" or $date_in_arhiv ne "on")) { ($d2,$m2,$y2)=split(/\./,$date2); ($h2,$minut2)=split(/:/,$time2); $endtime="$y2$m2$d2$h2$minut2"; if ($endtime <= $nowtime) {$to++; next SPISOK;} } if ($dez eq "1" or $dez eq "") {$show=$topic_design; $dez=2;} elsif ($topic_design2 ne "" & $dez eq "2") {$show=$topic_design2; $dez=3;} elsif ($topic_design3 ne "" & $dez eq "3") {$show=$topic_design3; $dez=1;} else {$show=$topic_design; $dez=2;} if ($input{dez} eq "2") { if ($razdel_tml_design2) {require "design/$razdel_tml_design2.tml"; $razdel_design2=$tml_design;} $show=$razdel_design2; } for ($n=0;$n<@users;$n++) { ($login,$pass,$status,$usermail)=split(/::/,$users[$n]); if ($login =~ "$user") { $user="$user<\/a>";} } if ($input{'base'} ne "" && $input{'base'} ne "last") { open (DATA, "<$servis/comments/$review.cnt"); $count=; close (DATA); $count="0" if (!$count); } open (REVIEW, "$servis/comments/$review.$ext"); @comments=; close (REVIEW); $number=$#comments; $number++; $number="0" if ($number eq 0 or $addcomm ne "on"); if ($op_num) { $base[$op_field] =~ s/\,/\./g; $op_num =~ s/\,/\./g; if ($op_op eq "umn") {$base[$op_field]=$base[$op_field]*$op_num;} if ($op_op eq "del") {$base[$op_field]=$base[$op_field]/$op_num;} if ($op_op eq "plus") {$base[$op_field]=$base[$op_field]+$op_num;} if ($op_op eq "minus") {$base[$op_field]=$base[$op_field]-$op_num;} } for ($f=0;$f<$fields;$f++) {$fil=$f+1; if ($base[$fil] ne "") { $show=~ s/<--$fil-->/$base[$fil]/gi; $show=~ s/<--$fil-->/$base[$fil]/gi; $kratko=$base[$fil]; $kratko=~s/<[\/\!]*?[^<>]*?>//g; $kratko=~s/\s+/ /g; $kratko=~ s/(.{300})(.*)/$1\.\./; $show=~ s/<--${fil}_mini-->/$kratko/gi; } else { $show=~ s/<--$fil-->//gi; $show=~ s/<--${fil}_mini-->//gi; } if ($base[$fil] ne "") {$show=~ s/<--name$fil-->/$massiv[$f]/gi; } else {$show=~ s/<--name$fil-->//gi;} } $show=~ s/<--name-->/$base[1]/gi ; if ($name) {$show=~ s/<--razdel-->/$name/gi ;} else {$show=~ s/<--razdel-->/$base[1]/gi ;} $show=~ s/<--date-->/$date/gi ; $show=~ s/<--time-->/$time/gi ; $show=~ s/<--date2-->/$date2/gi ; $show=~ s/<--time2-->/$time2/gi ; $show=~ s/<--user-->/$user/gi ; $show=~ s/<--number-->/$number/gi ; $show=~ s/<--count-->/$count/gi ; $id=$i+1+$input{from_id}; $num=$#list-$i; $show=~ s/<--id-->/$id/gi ; $show=~ s/<--sys_id-->/$num/gi ; if ($foto) { $show=~ s/<--foto-->/$upload\/$servis\/$foto/gi ; $show=~ s/<--foto_mini-->/$upload\/$servis\/mini_$foto/gi ; $show=~ s/<--foto_url-->/$upload\/$servis\/$foto/gi ; $show=~ s/<--foto_name-->/$upload\/$servis\/$foto/gi ; } else { $show=~ s/<--foto-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto_mini-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto_url-->/\#/gi ; $show=~ s/<--foto_name-->//gi ; } if ($foto2) { $show=~ s/<--foto2-->/$upload\/$servis\/$foto2/gi ; $show=~ s/<--foto2_mini-->/$upload\/$servis\/mini_$foto2/gi; $show=~ s/<--foto2_url-->/$upload\/$servis\/$foto2/gi ; $show=~ s/<--foto2_name-->/$upload\/$servis\/$foto2/gi ; } else { $show=~ s/<--foto2-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto2_mini-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto2_url-->/\#/gi ; $show=~ s/<--foto2_name-->//gi ; } if ($url2_on) { if (${base}) { $show=~ s/<--url-->/${topics_url}${base}\/$num.html/gi ; } else { $show=~ s/<--url-->/${topics_url}${num}.html/gi ; } } else {$show=~ s/<--url-->/$topics_url?base=$base&news=$num/gi ;} $show =~ s/(\b|\s|\()(http:\/\/[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show =~ s/(\s)(http:\/\/[\w,\-,\.,\/]+)(\s|
)/ $1
$2\<\/a\>$3/isg; $show =~ s/(\b|\s|\()(www\.[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show =~ s/(\s)(www\.[\w,\-,\.,\/]+)(\s|
)/
$2\<\/a\>$3/isg; $show =~ s/(\s)([\w,\-,\.]+\@[\w,\-,\.]+\.\w{2,3})/\ $2\<\/a\>/isg; print $show; } sub news { @list=reverse(@list); if ($news_tml) {require "design/$news_tml.tml"; $news_design=$tml_design;} $show=$news_design; chomp $list[$input{news}]; ($date,$time,$date2,$time2,$news,$user,$review,$foto,$foto2,$addcomm,$moder)=split(/::/,$list[$input{news}]); @base=split(/\|\^\|/,$news); @massiv=split("\@",$fields_name); exit if ($moder eq "wait"); ($d,$m,$y)=split(/\./,$date); ($h,$minut)=split(/:/,$time); $nowtime="$year$months[$mon]$mday$hour$min"; $posttime="$y$m$d$h$minut"; if ($posttime > $nowtime) {exit;} open (DATA, "<$servis/comments/$review.cnt"); $count=; close (DATA); $count++; open (DATA, ">$servis/comments/$review.cnt"); █ print DATA $count; &unblock; close (DATA); for ($n=0;$n<@users;$n++) { ($login,$pass,$status,$usermail)=split(/::/,$users[$n]); if ($login =~ "$user") { $user="$user<\/a>";} } for ($f=0;$f<$fields;$f++) { $fil=$f+1; $show=~ s/<--$fil-->/$base[$fil]/gi ; $kratko=$base[$fil]; $kratko=~s/<[\/\!]*?[^<>]*?>//g; $kratko=~s/\s+/ /g; $kratko=~ s/(.{300})(.*)/$1\.\./; $show=~ s/<--${fil}_mini-->/$kratko/gi; } for ($f=0;$f<$fields;$f++) {$fil=$f+1; if ($base[$fil] ne "") {$show=~ s/<--name$fil-->/$massiv[$f]/gi; } else {$show=~ s/<--name$fil-->//gi;} } $show=~ s/<--razdel-->/$name/gi ; $show=~ s/<--desk-->/$desk/gi ; $show=~ s/<--date-->/$date/gi ; $show=~ s/<--time-->/$time/gi ; $show=~ s/<--date2-->/$date2/gi ; $show=~ s/<--time2-->/$time2/gi ; $show=~ s/<--user-->/$user/gi ; $show=~ s/<--number-->/$number/gi ; $show=~ s/<--count-->/$count/gi ; if ($foto) { $show=~ s/<--foto-->/$upload\/$servis\/$foto/gi ; $show=~ s/<--foto_mini-->/$upload\/$servis\/mini_$foto/gi ; $show=~ s/<--foto_url-->/$upload\/$servis\/$foto/gi ; $show=~ s/<--foto_name-->/$upload\/$servis\/$foto/gi ; } else { $show=~ s/<--foto-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto_mini-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto_url-->/\#/gi ; $show=~ s/<--foto_name-->//gi ; } if ($foto2) { $show=~ s/<--foto2-->/$upload\/$servis\/$foto2/gi ; $show=~ s/<--foto2_mini-->/$upload\/$servis\/mini_$foto2/gi ; $show=~ s/<--foto2_url-->/$upload\/$servis\/$foto2/gi ; $show=~ s/<--foto2_name-->/$upload\/$servis\/$foto2/gi ; } else { $show=~ s/<--foto2-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto2_mini-->/$upload\/img\/1.gif width=1 height=1 border=0 /gi ; $show=~ s/<--foto2_url-->/\#/gi ; $show=~ s/<--foto2_name-->//gi ; } $num=$#list-$i; if ($url2_on) { if (${base}) { $show=~ s/<--url-->/${topics_url}${base}\/$input{news}.html/gi ; } else { $show=~ s/<--url-->/${topics_url}$input{news}.html/gi ; } } else {$show=~ s/<--url-->/$topics_url?base=$base&news=$input{news}/gi;} $show=~ s/<--link-->/$cgi\/$servis.$ext?base=$base&news=$input{news}/gi ; $show =~ s/(\b|\s|\()(http:\/\/[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show =~ s/(\s)(http:\/\/[\w,\-,\.,\/]+)(\s|
)/ $1
$2\<\/a\>$3/isg; $show =~ s/(\b|\s|\()(www\.[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show =~ s/(\s)(www\.[\w,\-,\.,\/]+)(\s|
)/
$2\<\/a\>$3/isg; $show =~ s/(\s)([\w,\-,\.]+\@[\w,\-,\.]+\.\w{2,3})/ $2\<\/a\>/isg; print $show; close (DATA); if ($comments_on eq "on" & $addcomm eq "on") { if ( $comments_place eq "out") { &comments_link; exit;} if ( $button_place eq "end") { &comments; &forma; } elsif ( $button_place eq "link_high") { &link; &comments; } elsif ( $button_place eq "link_end") { &comments; &link; } elsif ( $button_place eq "high") { &forma; &comments; } else {&comments;} } } sub comments { if ($comm_tml) {require "design/$comm_tml.tml"; $comment_design=$tml_design;} print qq(
$comments_text:

); open (REVIEW, "$servis/comments/$review.$ext"); @comments=; close (REVIEW); @comments=reverse(@comments) if ($comments_sort eq "last_top"); $page=$input{'com_page'}; if ($page eq "") {$page=1;} $from=($page-1)*$kolvo_com; $to=$page*$kolvo_com; if (@comments<$to) {$to=@comments;} for ($m=$from;$m<$to;$m++) { chomp $comments[$m]; ($date2,$time2,$comment,$name,$email2,$ip)=split(/::/,$comments[$m]); if ($email2 ne "") { $name="
$name<\/a>";} $show2=$comment_design; $show2=~ s/<--date-->/$date2/gi ; $show2=~ s/<--time-->/$time2/gi ; $show2=~ s/<--name-->/$name/gi ; $show2=~ s/<--comment-->/$comment/gi ; $show2=~ s/<--ip-->/$ip/gi ; $show2 =~ s/(\b|\s|\()(http:\/\/[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show2 =~ s/(\s)(http:\/\/[\w,\-,\.,\/]+)(\s|
)/ $1
$2\<\/a\>$3/isg; $show2 =~ s/(\b|\s|\()(www\.[\w,\-,\.,\/]+)(\,|\.\s|\))/ $1$2\<\/a\>$3/isg; $show2 =~ s/(\s)(www\.[\w,\-,\.,\/]+)(\s|
)/
$2\<\/a\>$3/isg; $show2 =~ s/(\s)([\w,\-,\.]+\@[\w,\-,\.]+\.\w{2,3})/ $2\<\/a\>/isg; print $show2; } &com_page; } sub com_page { $kolvo_pages=@comments/$kolvo_com; if ($kolvo_pages =~ /(\d+)\.(\d+)/) { $kolvo_pages=$1; $kolvo_pages++; } $page=$input{'com_page'}; if ($page eq "") {$page=1;} for ($i=1; $i<$page; $i++) {print qq( [$i] );} print qq( [$page]) if ($kolvo_pages>1); $i=1; for ($i+=$page; $i<=$kolvo_pages; $i++) {print qq( [$i]);} print qq(   Всего: ); print $#comments+1; } sub page { $vsego=@list-$topics; if ($arhiv eq "on" & $arhiv_topics ne "") {$vsego=@list-$main_topics;} $kolvo_pages=($#list)/$topics; if ($arhiv) {$go=1;} else {$go=0;} for ($i=$go; $i<$page_num; $i++) { $num=$i; $num++ if ($arhiv ne "on"); if ($url2_on) { if ($i eq "0") {$page_link=qq([$num]);} else { $page_link=qq([$num]); } } else {$page_link=qq([$num]);} print qq( $page_link ); } $num=$page_num; $num++ if ($arhiv ne "on"); print qq( [$num]) if ($kolvo_pages>=1); $i=1; for ($i+=$page_num; $i<=$kolvo_pages; $i++) {$num=$i; $num++ if ($arhiv ne "on"); if ($url2_on) {$page_link=qq([$num]);} else {$page_link=qq([$num]);} print qq( $page_link ); } if ($kolvo_on eq "on") { print qq(   Всего: ); if ($arhiv) {print $vsego;} else {print $#list+1;} } } sub add_pos { &cookie; if ($user_add eq "on") { if ($base eq "") {$base=0;} $rn=rand 999999; $img_code=sprintf "%.f", $rn; if ($ENV{'HTTP_X_FORWARDED_FOR'} ne "") {$ip=$ENV{'HTTP_X_FORWARDED_FOR'};} else {$ip=$ENV{'REMOTE_ADDR'};} $sec_code=crypt($img_code,$ip); ($s1,$s2,$s3,$s4,$s5,$s6)=split(//,$img_code); print qq(
Автор:
E-mail:
); @massiv=split("\@",$fields_name); for ($f=0;$f<$fields;$f++) {print qq( $massiv[$f]:

\n );} if ($load_foto1 eq "on") { print qq(Прикрепить файл:
); print qq((размер не более $foto1_size кб)
) if ($foto1_size); } if ($load_foto2 eq "on") { print qq(Прикрепить файл:
); print qq((размер не более $foto2_size кб)
) if ($foto2_size); } print qq(Перед отправкой введите код :
) if ($sec_code_on); print qq(
); } } sub add { if ( $button_place ne "none") { if ($ENV{'HTTP_X_FORWARDED_FOR'} ne "") {$ip=$ENV{'HTTP_X_FORWARDED_FOR'};} else {$ip=$ENV{'REMOTE_ADDR'};} if ($sec_code_on) { $sec_code=crypt($input{'img_code'},$ip); if ($sec_code ne "$input{'temp_code'}") {print "Content-type: text/html\n\n"; print $top; print qq(Вы ввели неверный код); print $bottom; die;} } $message=$input{'message'}; $message=~ s/(\S{50,})//gi; $name=$input{'name'}; $name=~ s/(\S{50,})//gi; $email=$input{'email'}; $email=~ s/(\S{50,})//gi; if ($email =~ /\=/) {print "Content-type: text/html\n\n"; print $top; print qq(Неверный e-mail); print $bottom; die;} $review=$input{'review'}; open (DATA, ">>$servis/comments/$review.$ext"); █ print DATA "$date1\:\:$time1\:\:$message \:\:$name\:\:$email\:\:$ip\n"; &unblock; close (DATA); #---------------------Установка Cookies и открытие главной страницы------- print "Set-Cookie: name=$name; expires=Friday,31-Dec-2090 23:59:59 GMT; path=/; domain=$domen;\n"; print "Set-Cookie: email=$email; expires=Friday,31-Dec-2090 23:59:59 GMT; path=/; domain=$domen;\n"; $http_referer=$input{'go'} if ($button_place eq "link_high" or $button_place eq "link_end"); } print "Location: $http_referer\n\n"; } sub repeat { #Если заполнены не все поля (и ява выключена) print qq(
Поля Имя и Комментарий являются обязательными для заполнения.
Пожалуйста, заполните их. ); } sub forma { &cookie; #-----------------------Рисуем форму--------------- $rn=rand 999999; $img_code=sprintf "%.f", $rn; if ($ENV{'HTTP_X_FORWARDED_FOR'} ne "") {$ip=$ENV{'HTTP_X_FORWARDED_FOR'};} else {$ip=$ENV{'REMOTE_ADDR'};} $sec_code=crypt($img_code,$ip); ($s1,$s2,$s3,$s4,$s5,$s6)=split(//,$img_code); print qq(
Добавить комментарий
Имя
E-mail:
Комментарий:

); print qq(Перед отправкой введите код :
) if ($sec_code_on); print qq(

); } sub link { $link=$ENV{'DOCUMENT_URI'}; $link=$topics_url if ($topics_url); $link=$news_url if ($news_url); print qq(

$button_text

); } sub comments_link { $link=$ENV{'DOCUMENT_URI'}; $link=$topics_url if ($topics_url); $link=$news_url if ($news_url); print qq(

$comments_text

); } print $bottom if ($input{'type'} ne "menu"); undef $v; exit;