Файл: cms.php
Строк: 2728
<?php
/*
FIXE CMS
Версия: 5.5
Автор: Ахрамеев Денис aka Includen
Сайт автора: www.ruxesoft.net
Все права защищены и принадлежат только Ахрамееву Денису. 2007-2009
1) Правообладателем, а также автором программы Fixe CMS и всех версий продукта
является Ахрамеев Денис. (Официальный сайт: www.ruxesoft.net).
2) Вы имеете право бесплатно использовать программу в течении неограниченного
срока. А также свободно распространять программу, не получая от этого ни
какой коммерческой выгоды и не нарушая целостность оригинального
дистрибутива.
3) Вы НЕ имеете право сдавать в аренду, продавать программу, а также изменять
файлы cms.php и data/modules.dat
4) При использовании любой части кода из программы в личных целях (например, для
написания собственной CMS) необходимо указывать следующее:
"Следующий код взят из Fixe CMS (www.ruxesoft.net)"
Однако, если Вы использовали более 6 кбайт кода из программы в личных целях,
то Вам необходимо разместить ссылку на сайт www.ruxesoft.net на видном месте,
например:
echo '<a href="http://www.ruxesoft.net" target="_blank">Скрипт написан
на основе кода Fixe CMS</a>';
5) Вы НЕ имеете право препятствовать/удалять или каким либо другим образом
мешать программе отображать в конце страниц сайта, использующего систему,
текст "Powered by Fixe CMS 5.5" (или "Движок сайта: Fixe CMS 5.5", либо
просто "Fixe CMS 5.5" - в зависимости от Ваших настроек в админ-центре) с
ссылкой на www.ruxesoft.net. Не забывайте, что если не будет отображаться тот
текст, то система будет переведена в состояние ограниченной функциональности!
6) Помните, что Fixe CMS держится лишь на чистом энтузиазме автора, прибыли от
программы никакой.
7) Программа распространяется по принципу "Как есть". Ни каких гарантий автор не
предоставляет, а также не несёт ответственности за порчу имущества или
информации программой.
8) Вы можете использовать данное программное обеспечение в любой стране мира.
9) Любые другие права, не указанные явно в настоящем Соглашении, принадлежат
Ахрамееву Денису.
10) Данное лицензионное соглашение может быть изменено для последующих версий
программного обеспечения без оглашения Вас об этом.
11) Если Вы не согласны с условиями данного Соглашения, Вы обязаны удалить
программу и все её части с Ваших носителей.
*/
$ttt=microtime();
$ttt=((double)strstr($ttt, ' ')+(double)substr($ttt,0,strpos($ttt,' ')));
if (isset($_GET['action'])) {
$action=$_GET['action'];
}
else
{
$action="";
};
if (isset($_GET['page'])) {
$page=$_GET['page'];
}
else
{
$page="";
};
include("cfg.inc.php");
include("data/language.php");
if ($cms_root=="default"){ $cms_root=$_SERVER['DOCUMENT_ROOT']; };
$test_cms = @file($cms_root."/data/faq.tpl");
if ($_SERVER['HTTP_USER_AGENT']=="Ya Mozilla!")
{
echo "<html><head><meta http-equiv="content-type" content="text/html; charset=Windows-1251"><title>ПасхалкО</title></head><body><center>";
echo "<table cellpadding=5 cellspacing=0 border=0>n";
echo "<tr><td align="center"><img src="im/fixecms.jpg" border=0><br><br><br></td></tr>n";
echo "<tr><Td align="center" bgcolor="#F7F7F7" style="border-top:2px solid #0000A0; border-bottom: 1px dashed #0000A0;"><b>ПасхалкО</b></td></tr>n";
echo "<tr><td style="border-left:1px dashed #0000A0; border-right:1px dashed #0000A0; border-bottom: 1px dashed #0000A0;">n";
echo "<center><i>Fixe CMS говорит:</i> Поздравляю! Ты нашёл пасхалку в Fixe CMS, подставив в User Agent <b>Ya Mozilla!</b><br>
<i>Fixe CMS говорит:</i> Но с таким User Agent'ом я тебя на сайт не пущу, меняй обратно ;)</center>";
echo " </td></tr>n";
echo "</table><br><br>nPowered by <a target="_blank" style="color:black;font-weight:bold;" href="http://www.ruxesoft.net/">Fixe CMS 5.5</a>";
echo "</center></body></html>";
exit;
};
if (!$test_cms)
{
$tmp=fopen("data/security.dat","w");
fwrite($tmp,"");
fclose($tmp);
echo "<html><head><meta http-equiv="content-type" content="text/html; charset=Windows-1251"><title>".$lcms['start_title']."</title></head><body><center>";
echo "<table cellpadding=5 cellspacing=0 border=0>n";
echo "<tr><td align="center"><img src="im/fixecms.jpg" border=0><br><br><br></td></tr>n";
echo "<tr><Td align="center" bgcolor="#F7F7F7" style="border-top:2px solid #0000A0; border-bottom: 1px dashed #0000A0;"><b>".$lcms['start_title']."</b></td></tr>n";
echo "<tr><td style="border-left:1px dashed #0000A0; border-right:1px dashed #0000A0; border-bottom: 1px dashed #0000A0;">n";
echo "<center>".$lcms['start_text']."</center>";
echo " </td></tr>n";
echo "</table><br><br>nPowered by <a target="_blank" style="color:black;font-weight:bold;" href="http://www.ruxesoft.net/">Fixe CMS 5.5</a>";
echo "</center></body></html>";
exit;
};
$posts_file=$cms_root."/data/guestbook.dat";
function itsbot($cms_usragnt)
{
if (strstr($cms_usragnt, "Yandex/"))
{
return "<b>Яндекс: Поисковой робот</b>|bot|";
}
else if (strstr($cms_usragnt, "DotBot/"))
{
return "<b>DotBot: Поисковой робот</b>|bot|";
}
else if (strstr($cms_usragnt, "Yahoo! Slurp"))
{
return "<b>Yahoo: Поисковой робот</b>|bot|";
}
else if (strstr($cms_usragnt, "compatible; www.cys.ru, Laboratory N3, Cybernetic biology"))
{
return "<b>CYS: Глючный сервис "оценки" качества сайта</b>|bot|";
}
else if (strstr($cms_usragnt, "robotgenius"))
{
return "<b>RobotGenius: Поисковой робот|bot|";
}
else if (strstr($cms_usragnt, "askpeter_bot/"))
{
return "<b>AskPeter: Поисковой робот|bot|";
}
else if (strstr($cms_usragnt, "ooglebot/"))
{
return "<b>Google: Поисковой робот</b>|bot|";
}
else if (strstr($cms_usragnt, "superbot.com; +http://www.super.info)"))
{
return "<b>Super.info: Поисковой робот</b>|bot|";
}
else if (strstr($cms_usragnt, "igdeSpyder"))
{
return "<b>igdeSpyder: Поисковой робот</b>|bot|";
}
else if (strstr($cms_usragnt, "http://www.cuil.com/twiceler/robot.html"))
{
return "<b>Twiceler: Поисковой робот</b>|bot|";
}
else if (strstr($cms_usragnt, "snbot/"))
{
return "<b>MSN: Поисковой робот</b>|bot|";
}
else if (strstr($cms_usragnt, "YandexBlog/"))
{
return "<b>YandexBlog: Поисковой робот</b>|bot|";
}
else if (strstr($cms_usragnt, "OmniExplorer_Bot/"))
{
return "<b>OmniExplorer: Поисковой робот</b>|bot|";
}
else if (strstr($cms_usragnt, "Baiduspider+"))
{
return "<b>Baiduspider: Поисковой робот</b>|bot|";
}
else if (strstr($cms_usragnt, "ovalebot"))
{
return "<b>Ovalebot: Поисковой робот</b>|bot|";
}
else if (strstr($cms_usragnt, "OOZBOT/"))
{
return "<b>OOZBOT: Поисковой робот</b>|bot|";
}
else
{
return $cms_usragnt."|people|";
};
};
include($cms_root."/data/modules.dat");
include($cms_root."/data/mods.php");
if ($cms_ban==1){
$ban_db = file($cms_root."/data/ban.dat");
$ban_found = 0;
foreach ($ban_db as $ban_one)
{
if ($_SERVER['REMOTE_ADDR']==str_replace("rn","",$ban_one))
{
$ban_found = 1;
break;
};
};
if ($ban_found==1)
{
echo "<html><head><meta http-equiv="content-type" content="text/html; charset=Windows-1251"><title>".$lcms['ban_title']."</title></head><body><center>";
echo "<table cellpadding=5 cellspacing=0 border=0>n";
echo "<tr><Td align="center" bgcolor="#F7F7F7" style="border-top:2px solid #0000A0; border-bottom: 1px dashed #0000A0;"><b>".$lcms['baned_title']."</b></td></tr>n";
echo "<tr><td style="border-left:1px dashed #0000A0; border-right:1px dashed #0000A0; border-bottom: 1px dashed #0000A0;">n";
echo "<center>".$lcms['baned_text']."</center>";
echo " </td></tr>n";
echo "</table><br><br>nPowered by <a target="_blank" style="color:black;font-weight:bold;" href="http://www.ruxesoft.net/">Fixe CMS 5.5</a>";
echo "</center></body></html>";
exit;
};
};
if ($cms_closed==1){
echo "<html><head><meta http-equiv="content-type" content="text/html; charset=Windows-1251"><title>".$lcms['closed_title']."</title></head><body><center>";
echo "<table cellpadding=5 cellspacing=0 border=0>n";
echo "<tr><Td align="center" bgcolor="#F7F7F7" style="border-top:2px solid #0000A0; border-bottom: 1px dashed #0000A0;"><b>".$lcms['closed']."</b></td></tr>n";
echo "<tr><td style="border-left:1px dashed #0000A0; border-right:1px dashed #0000A0; border-bottom: 1px dashed #0000A0;">n";
echo "<center>".$cms_closed_text."</center>";
echo " </td></tr>n";
echo "</table><br><br>nPowered by <a target="_blank" style="color:black;font-weight:bold;" href="http://www.ruxesoft.net/">Fixe CMS 5.5</a>";
echo "</center></body></html>";
exit;
};
function user_log($errno,$errmsg,$file,$line)
{
$time = date("d.m.y, H:i");
$error_log = fopen("data/errors.log","a");
fputs($error_log,$time."||".$errno."||".$errmsg."||".$file."||".$line."rn");
fclose($error_log);
};
function user_log_no($errno,$errmsg,$file,$line)
{
$time = date("d.m.y, H:i");
};
if ($cms_noshowerr==1)
{
ini_set('display_errors',0);
set_error_handler('user_log');
};
if ($cms_noshowerr==5)
{
ini_set('display_errors',0);
set_error_handler('user_log_no');
};
if ($cms_needcounter==1){
$ip_file = file($cms_root."/data/ip.dat");
$all_hosts_file = file($cms_root."/data/all_hosts.dat");
$all_hosts = $all_hosts_file[0];
$hosts = 0;
$bots = 0;
foreach ($ip_file as $ip_file_)
{
$ip_file__ = explode("|",$ip_file_);
if ($ip_file__[1] == "people")
{
$hosts = $hosts + 1;
}
else if ($ip_file__[1] == "bot")
{
$bots = $bots + 1;
};
};
$hits_file=file($cms_root."/data/hits.dat");
$all_hits_file=file($cms_root."/data/all_hits.dat");
$hits = $hits_file[0];
$all_hits = $all_hits_file[0];
};
function generate_code()
{
$gen_code[]=date("w");
$gen_code[]=date("d");
$gen_code[]=date("H");
$gen_code[]=substr(date("i"),0,1);
shuffle($gen_code);
return implode("",$gen_code);
};
function chec_code($code)
{
global $lcms,$cms_secpic, $cms_site, $_COOKIE, $_SERVER;
$cms_vremen=strtr($cms_site, ":./", "123");
if ($cms_secpic == 1) {
$right = $_COOKIE['cms_url_'.$cms_vremen].$_COOKIE['cms_var_'.$cms_vremen].$_COOKIE['cms_showex_'.$cms_vremen].$_COOKIE['cms_log_'.$cms_vremen];
$left = $code;
}
else
{
$right=$lcms['security_true'];
$left=$code;
};
if ($right==$left)
{
return TRUE;
}
else
{
return FALSE;
};
};
function img_code()
{
global $_SERVER,$cms_site;
$one_show=rand(1,9);
$two_show=rand(1,9);
$three_show=rand(1,9);
$four_show=rand(1,9);
$cms_vremen=strtr($cms_site, ":./", "123");
setcookie("cms_url_".$cms_vremen, $one_show, time() + 2700);
setcookie("cms_var_".$cms_vremen, $two_show, time() + 2700);
setcookie("cms_showex_".$cms_vremen, $three_show, time() + 2700);
setcookie("cms_log_".$cms_vremen, $four_show, time() + 2700);
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", 10000) . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-Type:image/png");
$img_arr = array("data/sec_back.png","data/sec_back2.png");
$img_fn = $img_arr[rand(0, sizeof($img_arr)-1)];
$im = imagecreatefrompng ($img_fn);
$color = imagecolorallocate($im, rand(0, 200), 0, rand(0, 200));
ImageString($im,6,rand(9, 25),rand(0, 12),$one_show,$color);
imageline($im, rand(0, 20), rand(1, 50), rand(150, 180), rand(1, 50), $color);
$color = imagecolorallocate($im, rand(0, 200), 0, rand(0, 200));
ImageString($im,6,rand(35, 50),rand(0, 12),$two_show,$color);
$color = imagecolorallocate($im, rand(0, 200), 0, rand(0, 200));
ImageString($im,6,rand(60, 70),rand(0, 12),$three_show,$color);
imageline($im, rand(0, 20), rand(1, 50), rand(150, 180), rand(1, 50), $color);
$color = imagecolorallocate($im, rand(0, 200), 0, rand(0, 200));
ImageString($im,6,rand(85, 90),rand(0, 12),$four_show,$color);
ImagePNG ($im);
ImageDestroy ($im);
};
if ($action=="codegen")
{
img_code();
exit;
};
function filtr($stroka)
{
return htmlspecialchars(stripslashes($stroka));
};
function TrueEmail($email){
return preg_match("/^([w.-])+@([w.-]+\.)+[a-z]{2,4}$/i", $email);
};
function HereEnd() {utnsppsll();};
function tomail($subject,$message)
{
global $cms_mail,$cms_sendmess,$_SERVER,$lcms;
if ($cms_sendmess==1)
{
$to = $cms_mail;
$headers = 'From: '.$lcms['faq_admin'].' <'.$cms_mail.">n";
$headers .= 'Reply-To: '.$cms_mail."n";
$headers .= 'Return-Path: '.$cms_mail."n";
$headers .= "MIME-Version: 1.0nContent-type: text/plain; charset=windows-1251nContent-Transfer-Encoding: 8bitnDate: " . gmdate('D, d M Y H:i:s', time()) . " UTnX-Priority: 3nX-MSMail-Priority: NormalnX-Mailer: PHPn";
//$headers = 'From: '.$cms_mail."rn" .
//'Reply-To: '.$cms_mail."rn" .
//'X-Mailer: PHP/' . phpversion();
$message = $message."n"
.$lcms['date']." ".date("d.m.y")."n"
."IP: ".$_SERVER['REMOTE_ADDR'];
//$message = convert_cyr_string ($message,k,w);
mail ($to,$subject,$message,$headers);
};
};
function view()
{
global $posts_file,$_GET,$rec_page,$cms_root,$lcms;
include($cms_root."/data/guestbook.tpl");
$messages = file($posts_file);
$messages = array_reverse($messages);
$count = count($messages);
if ($count>$rec_page) {
nav_page(ceil($count/$rec_page), (isset($_GET['page']) ?
$_GET['page']: 1),"?page=");
echo "<br>";
}
$num_page=1;
if (isset($_GET['page'])) {
if (($_GET['page']>0) and ($_GET['page']<=ceil($count/$rec_page))) $num_page=$_GET['page'];
}
for ( $i=($num_page-1)*$rec_page; $i<=(($num_page*$rec_page<$count) ? $num_page*$rec_page-1: $count-1); $i++) {
$tmp = explode("|",$messages[$i]);
echo "<b>".$lcms['gb_name_']." </b>".$tmp[0];
if ($tmp[1]){echo " (".$tmp[1].")";};
echo "n";
if ($tmp[2]!="http://"){echo "<br><b>".$lcms['gb_site']." </b><a target="_blank" href="".$tmp[2]."">".$tmp[2]."</a>";};
echo "<br>n";
echo "<b>".$lcms['gb_date']." </b>".$tmp[4];
echo "<br><br>n";
echo "<font style="".$gb_mess_style."">".$tmp[3]."</font>";
echo "<br><br><hr color="#EFEFEF" width="50%" size=1>";
}
if ($count>$rec_page) { nav_page(ceil($count/$rec_page),(isset($_GET['page']) ? $_GET['page']: 1),"?page="); }
echo "<br>";
};
function nav_page($count,$num_page,$url)
{
$page_nav = 3;
$begin_loop=1;
$end_loop=$count;
global $gb_mess_style,$lcms;
echo "<center><font style="".$gb_mess_style."">[ ".$lcms['gb_pages']." ($count):";
if ($num_page>$count or $num_page<1) $num_page=1;
if ($num_page>$page_nav) {
echo " <a href="$url".($page_nav*(floor($num_page/$page_nav)-($num_page%$page_nav==0 ? 1: 0)))."">(".($page_nav*(floor($num_page/$page_nav)-1-($num_page%$page_nav==0 ? 1: 0))+1)."-".($page_nav*(floor($num_page/$page_nav)-($num_page%$page_nav==0 ? 1: 0))).")</a> ...";
$begin_loop=$page_nav*(floor($num_page/$page_nav)-($num_page%$page_nav==0 ? 1: 0))+1;
}
if ($count>$page_nav*(floor($num_page/$page_nav)-($num_page%$page_nav==0 ? 1: 0)+1)) { $end_loop=$page_nav*ceil($num_page/$page_nav); }
for ($i = $begin_loop; $i <= $end_loop; $i++) {
if ($i==$num_page) echo " <b>$i</b>";
else echo " <a href="$url$i">$i</a>";
}
if ($count>$page_nav*(floor($num_page/$page_nav)-($num_page%$page_nav==0 ? 1: 0)+1)) {
echo " ... <a href="$url".($page_nav*ceil($num_page/$page_nav)+1)."">(".($page_nav*ceil($num_page/$page_nav)+1);
if ($page_nav*ceil($num_page/$page_nav)+1<$count) {
echo "-".($count<=$page_nav*(ceil($num_page/$page_nav)+1) ? $count: $page_nav*(ceil($num_page/$page_nav)+1));
}
echo ")</a>";
}
echo " ]</font></center>n";
};
function HereHosts(){global $hosts; echo $hosts;};
function HereBots() {global $bots; echo $bots;};
function HereHits(){global $hits; echo $hits;};
function HereAllHits(){global $all_hits; echo $all_hits;};
function HereAllHosts(){global $all_hosts; echo $all_hosts;};
function HereHead($fn_title)
{
global $cms_title,$cms_description,$cms_keys,$cms_copy,$cms_mail,$cms_site,
$cms_needrss, $cms_class,$cms_root, $cms_nocache,$lcms;
if ($cms_nocache==1)
{
header("Expires: Mod, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s", 10000) . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Cache-Control: post-check=0,pre-check=0", false);
header("Cache-Control: max-age=0",false);
header("Pragma: no-cache");
};
echo "<html>n<head>n<title>".$cms_title." ".$lcms['head_title']." ".$fn_title."</title>n";
echo "<meta http-equiv="content-type" content="text/html; charset=Windows-1251">n";
echo "<link rel="SHORTCUT ICON" href="".$cms_site."/favicon.ico">n";
echo "<meta name="keywords" content="".$cms_keys."">n";
echo "<meta http-equiv="keywords" content="".$cms_keys."">n";
echo "<meta name="robots" content="INDEX,ALL">n";
echo "<meta name="generator" content="Fixe CMS 5.5 (http://www.ruxesoft.net)">n";
echo "<meta name="description" content="".$cms_description."">n";
echo "<meta name="copyright" content="".$cms_copy."">n";
echo "<meta name="Document-state" content="Dynamic">n";
if ($cms_nocache==1)
{
echo "<meta http-equiv="Cache-Control" content="private">n";
};
echo "<meta name="revisit-after" content="10 days">n";
echo "<meta name="CATEGORY" content="".$cms_class."">n";
echo "<meta name="language" content="Russian,English">n";
echo "<meta name="rating" content="general">n";
echo "<meta name="resourse-type" content="document">n";
include($cms_root."/data/head.dat");
};
function HereForum()
{
global $cms_site,$cms_root;
echo "<center><form action="".$cms_site."/forum/loginout.php" method="post">n";
include($cms_root."/data/forum.tpl");
echo "</form></center>n";
};
function HereLinks()
{
global $cms_root,$cms_http,$cms_noindexlinks;
include ($cms_root."/data/links.tpl");
echo "<table border=0 cellpadding=3 cellspacing=2>n";
$links_data = file($cms_root.'/data/links.dat');
$links_data = array_reverse($links_data);
foreach($links_data as $element)
{
$element = trim($element);
$pieces = explode("|", $element);
echo '<tr><td style="'.$link_bgcolor.'">';
if ($cms_noindexlinks==1)
{
echo "<noindex>";
};
echo '<a style="'.$link_style.'" target="_blank" href="' . $pieces[0] . '">';
if ($cms_http==1)
{
echo str_replace("http://","",$pieces[0]);
}
else
{
echo $pieces[0];
};
echo '</a>';
if ($cms_noindexlinks==1)
{
echo "</noindex>";
};
echo '</td></tr>';
echo '<tr><td><font style="'.$link_dstyle.'">'. $pieces[1] . '</font></td></tr>';
}
echo "</table>n";
};
function HereVote()
{
global $cms_root,$cms_site,$cms_dayvote,$lcms;
if ($cms_dayvote==1)
{
$num_vote = date("w");
}
else
{
$num_vote = rand(0,6);
};
$vote_file=file($cms_root."/data/votes.dat");
$vote_qu=$vote_file[$num_vote*5];
$vote_a1=$vote_file[$num_vote*5+1];
$vote_a2=$vote_file[$num_vote*5+2];
$vote_a3=$vote_file[$num_vote*5+3];
$vote_a4=$vote_file[$num_vote*5+4];
include($cms_root."/data/votes.tpl");
echo "<FORM METHOD="POST" action="".$cms_site."/cms.php?action=vote">n";
echo "<center><font style="".$qu_style."">".$vote_qu."</font></center><br>n";
echo "<table border=0>n<tr><td>n";
echo '<input type="radio" name="answer" value=0><font style="'.$an_style.'">'.$vote_a1.'</font></td></tr><tr><td>';
echo "n";
echo '<input type="radio" name="answer" value=1><font style="'.$an_style.'">'.$vote_a2.'</font></td></tr><tr><td>';
echo "n";
echo '<input type="radio" name="answer" value=2><font style="'.$an_style.'">'.$vote_a3.'</font></td></tr><tr><td>';
echo "n";
echo '<input type="radio" name="answer" value=3><font style="'.$an_style.'">'.$vote_a4.'</font></td></tr><tr><td>';
echo "</table>n";
echo '<input type="hidden" name="von" value="'.$num_vote.'">';
echo '<input type="hidden" name="question" value="'.$vote_qu.'">';
echo '<input type="hidden" name="a1" value="'.$vote_a1.'">';
echo '<input type="hidden" name="a2" value="'.$vote_a2.'">';
echo '<input type="hidden" name="a3" value="'.$vote_a3.'">';
echo '<input type="hidden" name="a4" value="'.$vote_a4.'">';
echo "n<center><INPUT TYPE="Submit" style="".$bu_style."" NAME="vote" VALUE="".$lcms['vote_submit']."">n";
echo "<INPUT TYPE="Submit" style="".$bu_style."" NAME="result" VALUE="".$lcms['vote_result'].""></center>n";
echo "</FORM>n";
};
if ($action=="vote")
{
$von = str_replace(".","",$_POST['von']);
$answer = $_POST['answer'];
$question = $_POST['question'];
$file = $cms_root."/data/vote_".$von.".dat";
$a1 = $_POST['a1'];
$a2 = $_POST['a2'];
$a3 = $_POST['a3'];
$a4 = $_POST['a4'];
if (!file_exists($file)) { exit; };
$a = @file($file);
$i = 0;
$fi = Count($a)-1;
$n = 0;
while ($i <= $fi):
$a[$i] = trim(str_replace (" ","", $a[$i]));
$n = $n+$a[$i];
$i++;
endwhile;
$voted = $_COOKIE["voted".$von];
$voted_old = $voted;
if (($answer != "") && ($voted !="yes")){
setcookie("voted".$von,"yes",time() + 86400);
};
echo "<html>n<head>n<title>".$lcms['vote_submit_title']."</title>n<meta http-equiv="content-type" content="text/html; charset=Windows-1251">n<meta http-equiv="refresh" content="10;URL=".$_SERVER['HTTP_REFERER']."">n<style>BODY {background-color:#FFFFFF;}</style>n</head><body>n";
echo '<table border=1 bordercolor="#0000A0" cellspacing=0 width=100% height=100%>';
echo "n";
echo '<tr><td align="center">';
echo "n";
echo "<b>n";
echo '<font style="font-family:verdana,arial,ms sans serif;font-size:12pt;" color="#0000A0">';
if (($answer != "") && ($voted_old !="yes")){
echo "<br>".$lcms['vote_thanks']."";
echo "<br><font style="font-family:verdana,arial,ms sans serif;font-size:8pt;">";
$a[$answer]++; $n++;
$fp = @fopen($file,"w");
if ($fp) {
$counter=fputs($fp,$a[0]."
");
$counter=fputs($fp,$a[1]."
");
$counter=fputs($fp,$a[2]."
");
$counter=fputs($fp,$a[3]."
");
fclose($fp);
$summa = $a[0]+$a[1]+$a[2]+$a[3];
if ($summa!=0)
{
$pr1=intval($a[0]/$summa*100);
$pr2=intval($a[1]/$summa*100);
$pr3=intval($a[2]/$summa*100);
$pr4=intval($a[3]/$summa*100);
}
else
{
$pr1=0;
$pr2=0;
$pr3=0;
$pr4=0;
};
$mess = "".$lcms['vote_mess']." ".$question."<br><br>".$a1." - ".$a[0]." (".$pr1.
"%)<br>".$a2." - ".$a[1]." (".$pr2.
"%)<br>".$a3." - ".$a[2]." (".$pr3.
"%)<br>".$a4." - ".$a[3]." (".$pr4."%)";
$nm = fopen($cms_root."/data/new_messages.dat","a");
$mess = str_replace("rn","",$mess);
$mess = str_replace("n","",$mess);
fputs($nm,"".$lcms['vote_subject']."|yes|".$mess."<br><br>IP: ".$_SERVER['REMOTE_ADDR']."rn");
fclose($nm);
}
else { echo "Error! Please report to www.ruxesoft.net"; }
} else {
$summa = $a[0]+$a[1]+$a[2]+$a[3];
if ($summa!=0)
{
$pr1=intval($a[0]/$summa*100);
$pr2=intval($a[1]/$summa*100);
$pr3=intval($a[2]/$summa*100);
$pr4=intval($a[3]/$summa*100);
}
else
{
$pr1=0;
$pr2=0;
$pr3=0;
$pr4=0;
};
if ($voted =="yes") {
echo "".$lcms['vote_no']."";
}
echo "<br>".$lcms['vote_result2'].""; }
echo "<br><br><img src="admin/showvote.php?get=".$von."&rand=".rand(11111,999999)."" border=0><br><br>";
echo "<br><font style="font-size:10pt;">".$a1." - <b>".$a[0]." (".$pr1."%)</b>";
echo "<br>".$a2." - <b>".$a[1]." (".$pr2."%)</b>";
echo "<br>".$a3." - <b>".$a[2]." (".$pr3."%)</b>";
echo "<br>".$a4." - <b>".$a[3]." (".$pr4."%)</b></font>";
echo "<br><br>".$lcms['vote_all']." ".$n;
echo '<br><br>'.$lcms['refer1'].' <a href="'.$_SERVER['HTTP_REFERER'].'">'.$lcms['refer2'].'</a>';
echo '</font></font></b><br>';
HereEnd();
echo '</td></tr></table></body></html>';
};
function HereTopDownloads()
{
global $cms_root,$cms_site,$_SERVER;
include($cms_root."/data/top.tpl");
$top_db_download = file($cms_root."/data/downloads.dat");
foreach($top_db_download as $top_download)
{
$top_download = str_replace("rn","",$top_download);
$top_download = str_replace("n","",$top_download);
$top_download_ = explode("=",$top_download);
$top_db_new[] = $top_download_[1]."=".$top_download_[0];
};
natsort($top_db_new);
reset($top_db_new);
$top_db_new = array_reverse($top_db_new);
for ($i_=0;$i_<$top_count;$i_++)
{
$temp_ = explode("=",$top_db_new[$i_]);
echo "<a style="".$top_link."" href="".$cms_site."/download.php?get=".$temp_[1]."">".$temp_[1];
if ($top_show==1)
{
echo " (".$temp_[0].")</a><br>";
}
else
{
echo "</a><br>";
};
};
};
function HereTopViews()
{
global $cms_root,$cms_site,$_SERVER;
include($cms_root."/data/top.tpl");
$top_db_download = file($cms_root."/data/views.dat");
foreach($top_db_download as $top_download)
{
$top_download = str_replace("rn","",$top_download);
$top_download = str_replace("n","",$top_download);
$top_download_ = explode("=",$top_download);
$top_db_new[] = $top_download_[1]."=".$top_download_[0];
};
natsort($top_db_new);
reset($top_db_new);
$top_db_new = array_reverse($top_db_new);
for ($i_=0;$i_<$top_count;$i_++)
{
$temp_ = explode("=",$top_db_new[$i_]);
echo "<a style="".$top_link."" href="".$cms_site."/download.php?get=".$temp_[1]."">".$temp_[1];
if ($top_show==1)
{
echo " (".$temp_[0].")</a><br>";
}
else
{
echo "</a><br>";
};
};
};
function HereOnline()
{
global $cms_root,$_SERVER,$cms_online_time,$cms_needrecord,$lcms;
$online_data = file($cms_root."/data/online_users.dat");
$online_ip[0] = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$online_ip[1]=" ".$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$online_ip[1]='';
};
$tmp_usr = itsbot($_SERVER['HTTP_USER_AGENT']);
$tmp_usr_ = explode("|", $tmp_usr);
$online_user = $online_ip[0].$online_ip[1].'|'.$_SERVER['PHP_SELF'].'|'.time()."|".$tmp_usr_[0];
$online_user2 = explode("|",$online_user);
$online_users = array($lcms['much'],$lcms['one'],$lcms['much2']);
for ($onl=0;$onl<count($online_data);$onl++)
{
$online_tmp = explode("|",$online_data[$onl]);
if ($online_tmp[2]<time()-$cms_online_time*60)
{
}
else
{
if ($online_tmp[0]!=$online_user2[0])
{
$new_online_data[]=$online_data[$onl];
}
};
};
$new_online_data[] = $online_user;
$online_count= count($new_online_data);
echo $online_count.' ';
if ($cms_needrecord == 1) {
$record_online = file($cms_root."/data/online.dat");
if ($online_count>$record_online[0])
{
$record_online = fopen($cms_root."/data/online.dat","w");
flock($record_online,LOCK_EX);
fwrite($record_online,$online_count);
flock($record_online,LOCK_UN);
fclose($record_online);
};
};
$online_index = $online_count % 100;
if ($online_index >=11 && $online_index <= 14)
$online_index = 0;
else
$online_index = ($online_index %= 10) < 5 ? ($online_index > 2 ? 2 : $online_index): 0;
echo $online_users[$online_index];
$new_online = fopen($cms_root."/data/online_users.dat","w");
flock($new_online,LOCK_EX);
for ($onl=0; $onl<count($new_online_data); $onl++)
{
$new_online_data[$onl] = str_replace("rn","",$new_online_data[$onl]);
fwrite($new_online,$new_online_data[$onl]."rn");
};
flock($new_online,LOCK_UN);
fclose($new_online);
};
function HereMessages($id,$sname)
{
global $cms_root, $cms_site, $lcms, $_GET, $rec_page, $cms_secpic;
include($cms_root."/data/mess.tpl");
echo '<center><FORM ACTION="'.$cms_site.'/cms.php?action=new_message" METHOD="POST" NAME="add_mnenie">';
echo "n";
echo '<table border=0><tr><td><font style="'.$mess_form_style.'">'.$lcms['mess_name'].' <font color="red">*</font></font></td><td colspan=2>';
echo "
";
echo '<input type=text maxlength=15 size=30 name="name"></td></tr>';
echo "
<tr><td><font style="".$mess_form_style."">".$lcms['mess_mail']." <font color="red">*</font></font></td><td colspan=2>
<input type=text maxlength=60 size=30 name="email"></td></tr>
";
if ($cms_secpic == 1) {
echo '<tr><td><font style="'.$mess_form_style.'">'.$lcms['security'].' <font color="red">*</font></font></td><td align="center"><img src="'.$cms_site.'/cms.php?action=codegen&rand='.rand(1111,9999).'" width=100 height=30 border=0 alt="'.$lcms['security'].'"></td>';
}
else
{
echo '<tr><td><font style="'.$mess_form_style.'">'.$lcms['security_text'].' <font color="red">*</font></font></td><td align="center"><font style="'.$mess_form_style.'">'.$lcms['security_question'].'</font></td>';
};
echo '<td align="center"><input type=text maxlength=4 size=4 name="security"></td></tr><tr><td colspan=3 align="center">';
echo '<img src="'.$cms_site.'/im/1.gif" border=0 style="cursor:hand;" onClick="document.add_mnenie.text.value+='[1]';"> ';
echo '<img src="'.$cms_site.'/im/2.gif" border=0 style="cursor:hand;" onClick="document.add_mnenie.text.value+=':)';"> ';
echo "
";
echo '<img src="'.$cms_site.'/im/14.gif" border=0 style="cursor:hand;" onClick="document.add_mnenie.text.value+=';)';"> ';
echo '<img src="'.$cms_site.'/im/13.gif" border=0 style="cursor:hand;" onClick="document.add_mnenie.text.value+=':D';"> ';
echo '<img src="'.$cms_site.'/im/9.gif" border=0 style="cursor:hand;" onClick="document.add_mnenie.text.value+='[9]';"> ';
echo '<img src="'.$cms_site.'/im/8.gif" border=0 style="cursor:hand;" onClick="document.add_mnenie.text.value+=':(';"><br>';
echo '<img src="'.$cms_site.'/im/3.gif" border=0 style="cursor:hand;" onClick="document.add_mnenie.text.value+='[3]';"> ';
echo "
";
echo '<img src="'.$cms_site.'/im/19.gif" border=0 style="cursor:hand;" onClick="document.add_mnenie.text.value+='[19]';"> ';
echo '<img src="'.$cms_site.'/im/5.gif" border=0 style="cursor:hand;" onClick="document.add_mnenie.text.value+='[5]';"> ';
echo '<img src="'.$cms_site.'/im/18.gif" border=0 style="cursor:hand;" onClick="document.add_mnenie.text.value+='[18]';"> ';
echo '<img src="'.$cms_site.'/im/16.gif" border=0 style="cursor:hand;" onClick="document.add_mnenie.text.value+=';(';"> ';
echo '<img src="'.$cms_site.'/im/17.gif" border=0 style="cursor:hand;" onClick="document.add_mnenie.text.value+=':p';"></td></tr><tr><td colspan=3 align="center"><font style="'.$mess_form_style.'">';
echo "n".$lcms['mess_message']." <font color="red">*</font></font></td></tr>";
echo '<tr><td colspan=3 align="center"><textarea rows=4 cols=38 name="text"></textarea><br>';
echo "n";
echo "<input type="hidden" name="sname" value="".$sname."">n";
echo '<input type="hidden" name="id" value="'.$id.'">';
echo '<div align="center"><input type=submit name="submit" value="'.$lcms['mess_add'].'"></div></td></tr></table>';
echo '</form></center>';
/*$messdata = file($cms_root.'/data/mess_'.$id.'.dat');
$messdata = array_reverse($messdata);
foreach($messdata as $element)
{
$element = trim($element);
$pieces = explode("|", $element);
echo '<br><table width="100%" border=0><tr><td width=200><font style="'.$mess_name_style.'">'.$pieces[1].'</font></td><td align="right"><font style="'.$mess_date_style.'">'.$pieces[0].'</font></a></td></tr>';
echo '<tr><td colspan=2><font style="'.$mess_style.'">'.$pieces[2].'</font></td></tr>';
echo '</table><hr style="'.$mess_hr_style.'" width="50%">';
};
*/
$messdata = file($cms_root."/data/mess_".$id.".dat");
$mess_count=count($messdata);
$page=1;
if (isset($_GET['page'])) {
if (($_GET['page']>0) and ($_GET['page']<=ceil($mess_count/$rec_page))) $page=$_GET['page'];
}
$mess_j = ($mess_count-1)-(($page-1)*$rec_page);
$mess_i = $mess_j-$rec_page;
$mess_i_ = $mess_j-$rec_page;
$mess_all = ceil($mess_count/$rec_page);
echo "<center><font style="".$mess_style."">[ ".$lcms['gb_pages']." ";
for ($mess_i_=1; $mess_i_<=$mess_all;$mess_i_++) {
if ($page==$mess_i_) { echo "[".$mess_i_."] ";
}
else
{ echo '<a href="?page='.$mess_i_.'">'.$mess_i_.'</a> ';};}
echo ']</font></center><br>';
for (; $mess_i<$mess_j && $mess_j>=0; $mess_j--) {
$pieces = explode("|", $messdata[$mess_j]);
if ($pieces[3] == "yes") {
echo '<br><table width="100%" border=0><tr><td width=200><font style="'.$mess_name_style.'">'.$pieces[1].'</font></td><td align="right"><font style="'.$mess_date_style.'">'.$pieces[0].'</font></a></td></tr>';
echo '<tr><td colspan=2><font style="'.$mess_style.'">'.$pieces[2].'</font></td></tr>';
echo '</table><hr color="#EFEFEF" width="50%" size=1>'; };
}
echo '<center><font style="'.$mess_style.'">[ '.$lcms['gb_pages'].' ';
for ($mess_i=1; $mess_i<=$mess_all;$mess_i++) {
if ($page==$mess_i) { echo "[".$mess_i."] ";
} else { echo '<a href="?page='.$mess_i.'">'.$mess_i.'</a> ';};
}
echo ']</font></center><br>';
};
if ($action=="new_message")
{
$security = $_POST['security'];
$name = filtr($_POST['name']);
$email = filtr($_POST['email']);
$text = filtr($_POST['text']);
$sname = $_POST['sname'];
$id = $_POST['id'];
if ($_POST['submit'])
{
if (chec_code($security))
{
if (!$name) { echo $lcms['error_name']; exit; };
if (!TrueEmail($email)) { echo $lcms['error_mail']; exit; };
$email = str_replace("@","[собако]",$email);
if (!$text) { echo $lcms['error_message']; exit; };
if (strstr($name,"|")) { echo $lcms['serror_name']; exit; };
if (strstr($text,"|")) { echo $lcms['serror_message']; exit; };
if ($cms_domref==1){
if (!eregi($cms_site, $_SERVER['HTTP_REFERER'])) { echo $lcms['error_domref']; exit; };
};
$text = str_replace("[1]",'<img src="'.$cms_site.'/im/1.gif" border=0>',$text);
$text = str_replace("[2]",'<img src="'.$cms_site.'/im/2.gif" border=0>',$text);
$text = str_replace("[3]",'<img src="'.$cms_site.'/im/3.gif" border=0>',$text);
$text = str_replace("[4]",'<img src="'.$cms_site.'/im/4.gif" border=0>',$text);
$text = str_replace("[5]",'<img src="'.$cms_site.'/im/5.gif" border=0>',$text);
$text = str_replace("[6]",'<img src="'.$cms_site.'/im/6.gif" border=0>',$text);
$text = str_replace("[7]",'<img src="'.$cms_site.'/im/7.gif" border=0>',$text);
$text = str_replace("[8]",'<img src="'.$cms_site.'/im/8.gif" border=0>',$text);
$text = str_replace("[9]",'<img src="'.$cms_site.'/im/9.gif" border=0>',$text);
$text = str_replace("[10]",'<img src="'.$cms_site.'/im/10.gif" border=0>',$text);
$text = str_replace("[11]",'<img src="'.$cms_site.'/im/11.gif" border=0>',$text);
$text = str_replace("[12]",'<img src="'.$cms_site.'/im/12.gif" border=0>',$text);
$text = str_replace("[13]",'<img src="'.$cms_site.'/im/13.gif" border=0>',$text);
$text = str_replace("[14]",'<img src="'.$cms_site.'/im/14.gif" border=0>',$text);
$text = str_replace("[15]",'<img src="'.$cms_site.'/im/15.gif" border=0>',$text);
$text = str_replace("[16]",'<img src="'.$cms_site.'/im/16.gif" border=0>',$text);
$text = str_replace("[17]",'<img src="'.$cms_site.'/im/17.gif" border=0>',$text);
$text = str_replace("[18]",'<img src="'.$cms_site.'/im/18.gif" border=0>',$text);
$text = str_replace("[19]",'<img src="'.$cms_site.'/im/19.gif" border=0>',$text);
$text = str_replace("=)",'<img src="'.$cms_site.'/im/2.gif" border=0>',$text);
$text = str_replace(":)",'<img src="'.$cms_site.'/im/2.gif" border=0>',$text);
$text = str_replace(":-)",'<img src="'.$cms_site.'/im/2.gif" border=0>',$text);
$text = str_replace(":p",'<img src="'.$cms_site.'/im/17.gif" border=0>',$text);
$text = str_replace(":D",'<img src="'.$cms_site.'/im/13.gif" border=0>',$text);
$text = str_replace(";)",'<img src="'.$cms_site.'/im/14.gif" border=0>',$text);
$text = str_replace(";-)",'<img src="'.$cms_site.'/im/14.gif" border=0>',$text);
$text = str_replace(";(",'<img src="'.$cms_site.'/im/16.gif" border=0>',$text);
$text = str_replace(";-(",'<img src="'.$cms_site.'/im/16.gif" border=0>',$text);
$text = str_replace(":(",'<img src="'.$cms_site.'/im/8.gif" border=0>',$text);
$text = str_replace("=(",'<img src="'.$cms_site.'/im/8.gif" border=0>',$text);
$text = str_replace(":-(",'<img src="'.$cms_site.'/im/8.gif" border=0>',$text);
$text = str_replace("rn","<br>",$text);
$file = fopen($cms_root."/data/mess_".$id.".dat","a");
if ($cms_premoder==1) {
$premoderacia="no";
}
else {
$premoderacia="yes";
};
fputs ($file,date("d.m.y")."|".$name."|".$text."|".$premoderacia."|rn");
fclose($file);
tomail($lcms['mess_title']." ".$sname,$lcms['mess_name']." ".$name."n".$lcms['mess_message']." ".$text);
$file = fopen($cms_root."/data/new_messages.dat","a");
fwrite($file,$lcms['mess_title']." ".$sname."|".$premoderacia."|".$lcms['mess_name']." ".$name."<br>E-mail: ".$email."<br>IP: ".$_SERVER['REMOTE_ADDR']."<br>".$lcms['date']." ".date("d.m.y")."<br>".$lcms['mess_message']." ".$text."rn");
fclose($file);
echo '<html><head><title>'.$lcms['mess_submit_title'].'</title><meta http-equiv="content-type" content="text/html; charset=Windows-1251"><meta http-equiv="refresh" content="2;URL='.$_SERVER['HTTP_REFERER'].'"></head><style>BODY {background-color:#FFFFFF;}</style><body>';
echo '<table border=1 bordercolor="#0000A0" cellspacing=0 width=100% height=100%><tr><td align="center"><b><font style="font-family:verdana,arial,ms sans serif;font-size:12pt;" color="#0000A0">'.$lcms['mess_submit_title'].'<br><font style="font-family:verdana,arial,ms sans serif;font-size:8pt;">'.$lcms['refer1'].' <a href="'.$_SERVER['HTTP_REFERER'].'">'.$lcms['refer2'].'</a></font></font></b><br><br><br>';
HereEnd();
echo '</td></tr></table></body></html>';
}
else
{
echo $lcms['error_security'];
exit;
};
};
};
function HereGB()
{
global $cms_root, $_GET, $cms_site, $lcms, $rec_page, $cms_premoder, $cms_secpic;
include($cms_root."/data/guestbook.tpl");
echo "<br><center><form name="post" action="".$cms_site."/cms.php?action=posting" method="post"><table border=0 cellpadding=3 cellspacing=0>n";
echo "<tr><td width="50%"><font style="".$gb_text_style."">".$lcms['gb_name']."<font color="red">*</font></font></td><td colspan=2><input type="text" style="".$gb_input_style."" name="name" size=30 maxlength=32></td></tr>n";
echo "<tr><td width="50%"><font style="".$gb_text_style."">".$lcms['gb_mail']."<font color="red">*</font></font></td><td colspan=2><input type="text" name="mail" style="".$gb_input_style."" size=30 maxlength=60></td></tr>n";
echo "<tr><td width="50%"><font style="".$gb_text_style."">".$lcms['gb_site']."</font></td><td colspan=2><input type="text" name="url" style="".$gb_input_style."" value="http://" size=30 maxlength=32></td></tr>n";
if ($cms_secpic == 1) {
echo "<tr><td width="50%"><font style="".$gb_text_style."">".$lcms['security']."<font color="red">*</font></font></td><td align="center"><img src="".$cms_site."/cms.php?action=codegen&rand=".rand(1111,9999)."" alt="".$lcms['security']."" width=100 height=30 border=0></td>n<td><input type="text" name="security" style="".$gb_input_style."" size=4 maxlength=4></td></tr>n";
}
else
{
echo "<tr><td width="50%"><font style="".$gb_text_style."">".$lcms['security_text']."<font color="red">*</font></font></td><td align="center"><font style="".$gb_text_style."">".$lcms['security_question']."</font></td>n<td><input type="text" name="security" style="".$gb_input_style."" size=4 maxlength=4></td></tr>n";
};
echo '<tr><td align="center" colspan=3>'
.' <img src="'.$cms_site.'/im/1.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[1]';">'
.' <img src="'.$cms_site.'/im/14.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=';)';">'
.' <img src="'.$cms_site.'/im/13.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=':D';">'
.' <img src="'.$cms_site.'/im/2.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=':)';">'
.' <img src="'.$cms_site.'/im/9.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[9]';">'
.' <img src="'.$cms_site.'/im/19.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[19]';">'
.' <img src="'.$cms_site.'/im/17.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=':p';">'
.' <img src="'.$cms_site.'/im/8.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=':(';">'
.' <img src="'.$cms_site.'/im/3.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[3]';">'
.' <img src="'.$cms_site.'/im/5.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[5]';"><br>'
.' <img src="'.$cms_site.'/im/11.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[11]';">'
.' <img src="'.$cms_site.'/im/12.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[12]';">'
.' <img src="'.$cms_site.'/im/15.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[15]';">'
.' <img src="'.$cms_site.'/im/16.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=';(';">'
.' <img src="'.$cms_site.'/im/18.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[18]';">'
.' <img src="'.$cms_site.'/im/7.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[7]';">'
.' <input type="button" value="'.$lcms['gb_b'].'" style="font-weight:bold" onClick="document.post.message.value+='[b][/b]';">'
.' <input type="button" value="'.$lcms['gb_i'].'" style="font-style:italic" onClick="document.post.message.value+='[i][/i]';">'
.' <input type="button" value="'.$lcms['gb_u'].'" style="text-decoration:underline" onClick="document.post.message.value+='[u][/u]';">'
.'</td></tr>';
echo "<tr><td colspan=3><font style="".$gb_text_style."">".$lcms['gb_messages']."<font color="red">*</font></font><br><textarea style="".$gb_input_style."" name="message" cols=50 rows=8></textarea></td></tr>n";
echo "<tr><td colspan=3 align="center"><input type="submit" name="submit" value="".$lcms['gb_add']."" style="".$gb_input_style.""></td></tr>";
echo "</table></form></center>";
$gb_db = file($cms_root."/data/guestbook.dat");
$gb_count=count($gb_db);
$page=1;
if (isset($_GET['page'])) {
if (($_GET['page']>0) and ($_GET['page']<=ceil($gb_count/$rec_page))) $page=$_GET['page'];
}
$gb_j = ($gb_count-1)-(($page-1)*$rec_page);
$gb_i = $gb_j-$rec_page;
$gb_i_ = $gb_j-$rec_page;
$gb_all = ceil($gb_count/$rec_page);
echo "<center><font style="".$gb_mess_style."">[ ".$lcms['gb_pages']." ";
for ($gb_i_=1; $gb_i_<=$gb_all;$gb_i_++) {
if ($page==$gb_i_) { echo "[".$gb_i_."] ";
}
else
{ echo '<a href="?page='.$gb_i_.'">'.$gb_i_.'</a> ';};}
echo ']</font></center><br>';
for (; $gb_i<$gb_j && $gb_j>=0; $gb_j--) {
$tmp = explode("|",$gb_db[$gb_j]);
if ($tmp[6] == "yes") {
echo "<b>".$lcms['gb_name_']." </b>".$tmp[0];
//if ($tmp[1]){echo " (".$tmp[1].")";};
echo "n";
if ($tmp[2]!="http://"){echo "<br><b>".$lcms['gb_site']." </b><a target="_blank" href="".$tmp[2]."">".$tmp[2]."</a>";};
echo "<br>n";
echo "<b>".$lcms['gb_date']." </b>".$tmp[4];
echo "<br><br>n";
echo "<font style="".$gb_mess_style."">".$tmp[3]."</font>";
echo "<br><br><hr color="#EFEFEF" width="50%" size=1>";
}
}
echo '<center><font style="'.$gb_mess_style.'">[ '.$lcms['gb_pages'].' ';
for ($gb_i=1; $gb_i<=$gb_all;$gb_i++) {
if ($page==$gb_i) { echo "[".$gb_i."] ";
} else { echo '<a href="?page='.$gb_i.'">'.$gb_i.'</a> ';};
}
echo ']</font></center><br>';
};
if ($action=="posting")
{
$security = $_POST['security'];
$name = filtr($_POST['name']);
$mail = filtr($_POST['mail']);
$url = filtr($_POST['url']);
$message = filtr($_POST['message']);
$date = date("d.m.y, H:i");
$ip = $_SERVER['REMOTE_ADDR'];
$message = str_replace("[b]","<b>",$message);
$message = str_replace("[/b]","</b>",$message);
$message = str_replace("[i]","<i>",$message);
$message = str_replace("[/i]","</i>",$message);
$message = str_replace("[u]","<u>",$message);
$message = str_replace("[/u]","</u>",$message);
$message = str_replace("[1]",'<img src="'.$cms_site.'/im/1.gif" border=0>',$message);
$message = str_replace("[2]",'<img src="'.$cms_site.'/im/2.gif" border=0>',$message);
$message = str_replace("[3]",'<img src="'.$cms_site.'/im/3.gif" border=0>',$message);
$message = str_replace("[4]",'<img src="'.$cms_site.'/im/4.gif" border=0>',$message);
$message = str_replace("[5]",'<img src="'.$cms_site.'/im/5.gif" border=0>',$message);
$message = str_replace("[6]",'<img src="'.$cms_site.'/im/6.gif" border=0>',$message);
$message = str_replace("[7]",'<img src="'.$cms_site.'/im/7.gif" border=0>',$message);
$message = str_replace("[8]",'<img src="'.$cms_site.'/im/8.gif" border=0>',$message);
$message = str_replace("[9]",'<img src="'.$cms_site.'/im/9.gif" border=0>',$message);
$message = str_replace("[10]",'<img src="'.$cms_site.'/im/10.gif" border=0>',$message);
$message = str_replace("[11]",'<img src="'.$cms_site.'/im/11.gif" border=0>',$message);
$message = str_replace("[12]",'<img src="'.$cms_site.'/im/12.gif" border=0>',$message);
$message = str_replace("[13]",'<img src="'.$cms_site.'/im/13.gif" border=0>',$message);
$message = str_replace("[14]",'<img src="'.$cms_site.'/im/14.gif" border=0>',$message);
$message = str_replace("[15]",'<img src="'.$cms_site.'/im/15.gif" border=0>',$message);
$message = str_replace("[16]",'<img src="'.$cms_site.'/im/16.gif" border=0>',$message);
$message = str_replace("[17]",'<img src="'.$cms_site.'/im/17.gif" border=0>',$message);
$message = str_replace("[18]",'<img src="'.$cms_site.'/im/18.gif" border=0>',$message);
$message = str_replace("[19]",'<img src="'.$cms_site.'/im/19.gif" border=0>',$message);
$message = str_replace("=)",'<img src="'.$cms_site.'/im/2.gif" border=0>',$message);
$message = str_replace(":)",'<img src="'.$cms_site.'/im/2.gif" border=0>',$message);
$message = str_replace(":-)",'<img src="'.$cms_site.'/im/2.gif" border=0>',$message);
$message = str_replace(":p",'<img src="'.$cms_site.'/im/17.gif" border=0>',$message);
$message = str_replace(":D",'<img src="'.$cms_site.'/im/13.gif" border=0>',$message);
$message = str_replace(";)",'<img src="'.$cms_site.'/im/14.gif" border=0>',$message);
$message = str_replace(";(",'<img src="'.$cms_site.'/im/16.gif" border=0>',$message);
$message = str_replace(";-(",'<img src="'.$cms_site.'/im/16.gif" border=0>',$message);
$message = str_replace(";-)",'<img src="'.$cms_site.'/im/14.gif" border=0>',$message);
$message = str_replace(":(",'<img src="'.$cms_site.'/im/8.gif" border=0>',$message);
$message = str_replace("=(",'<img src="'.$cms_site.'/im/8.gif" border=0>',$message);
$message = str_replace(":-(",'<img src="'.$cms_site.'/im/8.gif" border=0>',$message);
$message = str_replace("rn","<br>",$message);
if ($_POST['submit'])
{
if (chec_code($security))
{
if (!$name) { echo $lcms['error_name']; exit; };
if (!$message) { echo $lcms['error_message']; exit; };
if (!TrueEmail($mail)) { echo $lcms['error_mail']; exit; };
$mail = str_replace("@","[собако]",$mail);
if (strstr($name,"|")) { echo $lcms['serror_name']; exit; };
if (strstr(strtolower($name),strtolower($lcms['faq_admin']))) { echo $lcms['error_name2']; exit; };
if (strstr($message,"|")) { echo $lcms['serror_message']; exit; };
if ($cms_domref==1){
if (!eregi($cms_site, $_SERVER['HTTP_REFERER'])) { echo $lcms['error_domref']; exit; };
};
$file = fopen($cms_root."/data/guestbook.dat","a");
if ($cms_premoder==1) {
$premoderacia="no";
}
else {
$premoderacia="yes";
};
$line = $name."|".$mail."|".$url."|".$message."|".$date."|".$ip."|".$premoderacia."|";
$line = str_replace("rn","<BR>",$line);
$line .= "rn";
fputs($file, "$line");
fclose($file);
$subject = $lcms['gb_subject'];
tomail($subject,$lcms['gb_name']." ".$name."n".$lcms['gb_mail'].": ".$mail."n".$lcms['gb_message'].": ".$message);
$nm=fopen($cms_root."/data/new_messages.dat","a");
fwrite($nm,$subject."|".$premoderacia."|".$lcms['gb_name']." ".$name."<br>".$lcms['date']." ".date("d.m.y")."<br>".$lcms['gb_site']." ".$url."<br>".$lcms['gb_mail']." ".$mail."<br>IP: ".$_SERVER['REMOTE_ADDR']."<br>".$lcms['gb_message']." ".$message."rn");
fclose($nm);
echo '<html><head><title>'.$lcms['gb_submit_title'].'</title><meta http-equiv="content-type" content="text/html; charset=Windows-1251"><meta http-equiv="refresh" content="2;URL='.$_SERVER['HTTP_REFERER'].'"></head><style>BODY {background-color:#FFFFFF;}</style><body>';
echo '<table border=1 bordercolor="#0000A0" cellspacing=0 width=100% height=100%><tr><td align="center"><b><font style="font-family:verdana,arial,ms sans serif;font-size:12pt;" color="#0000A0">'.$lcms['gb_submit_title'].'<br><font style="font-family:verdana,arial,ms sans serif;font-size:8pt;">'.$lcms['refer1'].' <a href="'.$_SERVER['HTTP_REFERER'].'">'.$lcms['refer2'].'</a></font></font></b><br><br><br>';
HereEnd();
echo '</td></tr></table></body></html>';
}
else
{
echo $lcms['error_security'];
exit;
};
}
else
{
echo $lcms['hack'];
exit;
};
};
function HereNews()
{
global $cms_root,$cms_site,$rec_page,$_GET,$_SERVER,$_POST,$lcms,$cms_premoder, $cms_secpic;
include($cms_root."/data/news.tpl");
if (isset($_GET['comment']))
{
$comment = filtr($_GET['comment']);
$comment = str_replace(".","",$comment);
}
else
{
$comment = "no_comment";
}
if (($comment) && (file_exists($cms_root."/data/news/".$comment.".txt")))
{
$db_news = file($cms_root."/data/news/".$comment.".txt");
$db_new = explode("|",$db_news[0]);
$all = count($db_news)-1;
//echo "<center><font style="".$news_title."">".$db_new[2]."</font></center>n";
$news_db_title=$db_new[2];
//echo "<br><font style="".$news_message."">".$db_new[3]."</font>n";
//echo "<table border=0 width="100%" cellpadding=2 cellspacing=0>n";
//echo "<tr><td style="".$news_down.""><font style="".$news_comment."">".$lcms['news_author']." <b>".$db_new[1]."</b> | ".$lcms['news_added']." <b>".$db_new[0]."</b> | ".$lcms['news_nast']." <b>".$db_new[4]."</b></font></td></tr>n";
//echo "</table><br>n";
echo "<center><a href="".$db_new[4]."" style="".$news_title."">".$db_new[2]."</a></center>n";
echo "<br><font style="".$news_message."">".$db_new[3]."</font>n";
echo "<table border=0 width="100%" cellpadding=2 cellspacing=0>n";
echo "<tr><td style="".$news_down.""><font style="".$news_comment."">".$lcms['news_author']." <b>".$db_new[1]."</b> | ".$lcms['news_added']." <b>".$db_new[0]."</b></font></td></tr>n";
echo "</table><br>n";
echo "<table bgcolor="#FBFBFF" border=0 cellpadding=2 cellspacing=0 width="100%">n";
for ($tmp=1;$tmp<count($db_news);$tmp++)
{
$new_news[]=$db_news[$tmp];
};
$gb_count=count($new_news);
$page=1;
if (isset($_GET['page'])) {
if (($_GET['page']>0) and ($_GET['page']<=ceil($gb_count/$rec_page))) $page=$_GET['page'];
}
$gb_j = ($gb_count-1)-(($page-1)*$rec_page);
$gb_i = $gb_j-$rec_page;
$gb_i_ = $gb_j-$rec_page;
$gb_all = ceil($gb_count/$rec_page);
echo "<tr><td colspan=2><center><font style="".$news_message."">[ ".$lcms['gb_pages']." ";
for ($gb_i_=1; $gb_i_<=$gb_all;$gb_i_++) {
if ($page==$gb_i_) { echo "[".$gb_i_."] ";
}
else
{ echo '<a href="?comment='.$comment.'&page='.$gb_i_.'">'.$gb_i_.'</a> ';};}
echo ']</font></center></td></tr>';
//$all=$page/$rec_page+$all;
for (; $gb_i<$gb_j && $gb_j>=0; $gb_j--) {
$db_new = explode("|",$new_news[$gb_j]);
if ($cms_premoder == 1) {
if ($db_new[6] == "yes") {
$show_news_comment = 1;
}
else {
$show_news_comment = 0;
};
}
else {
$show_news_comment = 1;
};
if ($show_news_comment == 1) {
echo "<tr><td align=left><font style="".$news_comment.""><b>".$db_new[1]."</b></font></td><td align=right><font style="".$news_comment."">".$db_new[0]."</font></td></tr>n";
echo "<tr><td colspan=2><font style="".$news_message."">".$db_new[3]."</font></td></tr>n";
};
//$all=$all-1;
}
echo '<tr><td colspan=2><center><font style="'.$news_message.'">[ '.$lcms['gb_pages'].' ';
for ($gb_i=1; $gb_i<=$gb_all;$gb_i++) {
if ($page==$gb_i) { echo "[".$gb_i."] ";
} else { echo '<a href="?comment='.$comment.'&page='.$gb_i.'">'.$gb_i.'</a> ';};
}
echo ']</font></center></td></tr>';
echo "</table><br><a href="".$_SERVER['PHP_SELF']."">".$lcms['blog_back']."</a><br>n";
echo "<br><center><form name="post" action="".$cms_site."/cms.php?action=add_comment_news&comment=".$comment."" method="post"><table border=0 cellpadding=3 cellspacing=0>n";
echo "<tr><td width="50%"><font style="".$news_message."">".$lcms['news_name']."<font color="red">*</font></td><td colspan=2><input type="text" style="".$news_message."" name="name" size=24 maxlength=32></td></tr>n";
echo "<tr><td width="50%"><font style="".$news_message."">".$lcms['news_mail']."<font color="red">*</font></td><td colspan=2><input type="text" name="mail" style="".$news_message."" size=24 maxlength=60></td></tr>n";
if ($cms_secpic == 1) {
echo "<tr><td width="50%"><font style="".$news_message."">".$lcms['security']."<font color="red">*</font></td><td align="center"><img src="".$cms_site."/cms.php?action=codegen&rand=".rand(1111,9999)."" alt="".$lcms['security']."" width=100 height=30 border=0></td>n<td><input type="text" name="security" style="".$news_message."" size=4 maxlength=4></td></tr>n";
}
else
{
echo "<tr><td width="50%"><font style="".$news_message."">".$lcms['security_text']."<font color="red">*</font></td><td align="center"><font style="".$news_message."">".$lcms['security_question']."</font></td>n<td><input type="text" name="security" style="".$news_message."" size=4 maxlength=4></td></tr>n";
};
echo '<tr><td align="center" colspan=3>'
.' <img src="'.$cms_site.'/im/1.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[1]';">'
.' <img src="'.$cms_site.'/im/14.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=';)';">'
.' <img src="'.$cms_site.'/im/13.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=':D';">'
.' <img src="'.$cms_site.'/im/2.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=':)';">'
.' <img src="'.$cms_site.'/im/9.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[9]';">'
.' <img src="'.$cms_site.'/im/19.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[19]';">'
.' <img src="'.$cms_site.'/im/17.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=':p';">'
.' <img src="'.$cms_site.'/im/8.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=':(';">'
.' <img src="'.$cms_site.'/im/3.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[3]';">'
.' <img src="'.$cms_site.'/im/5.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[5]';"><br>'
.' <img src="'.$cms_site.'/im/11.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[11]';">'
.' <img src="'.$cms_site.'/im/12.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[12]';">'
.' <img src="'.$cms_site.'/im/15.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[15]';">'
.' <img src="'.$cms_site.'/im/16.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=';(';">'
.' <img src="'.$cms_site.'/im/18.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[18]';">'
.' <img src="'.$cms_site.'/im/7.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[7]';">'
.' <input type="button" value="'.$lcms['news_b'].'" style="font-weight:bold" onClick="document.post.message.value+='[b][/b]';">'
.' <input type="button" value="'.$lcms['news_i'].'" style="font-style:italic" onClick="document.post.message.value+='[i][/i]';">'
.' <input type="button" value="'.$lcms['news_u'].'" style="text-decoration:underline" onClick="document.post.message.value+='[u][/u]';">'
.'</td></tr>';
echo "<tr><td colspan=3 align="left"><font style="".$news_message."">".$lcms['news_message']."<font color="red">*</font><br><textarea style="".$news_message."" name="message" cols=50 rows=8></textarea></td></tr>n";
echo "<tr><td colspan=3 align="center"><input type="hidden" name="title_news" value="".$news_db_title.""><input type="submit" name="submit" value="".$lcms['news_submit'].""></td></tr>";
echo "</table></form></center>";
}
else
{
$db_news = file($cms_root."/data/news/list.txt");
$db_news = array_reverse($db_news);
foreach ($db_news as $db_new_)
{
$db_new = explode("|",$db_new_);
$massiv[]=$db_new_;
$file = $db_new[6];
$all = count(file($cms_root."/data/news/".$file.".txt"))-1;
echo "<center><a href="?comment=".str_replace(".txt","",$file)."" style="".$news_title."">".$db_new[2]."</a></center>n";
echo "<br><font style="".$news_message."">".$db_new[3]."</font>n";
echo "<table border=0 width="100%" cellpadding=2 cellspacing=0>n";
echo "<tr><td style="".$news_down.""><font style="".$news_comment."">".$lcms['news_author']." <b>".$db_new[1]."</b> | ".$lcms['news_added']." <b>".$db_new[0]."</b> | Комментариев: <b>".$all."</b> | <a style="".$news_link."" href="?comment=".str_replace(".txt","",$file)."">Читать дальше</a></font></td></tr>n";
echo "</table><br>n";
};
//echo "<br><br>".$lcms['news_all']." ".count($massiv);
};
};
function HereMail()
{
global $cms_root,$cms_site,$lcms,$cms_secpic;
include($cms_root."/data/mail.tpl");
echo '<form name="send_mail" action="'.$cms_site.'/cms.php?action=tomail" method="post">';
echo "n";
echo '<center><table border=0 cellpadding=3 cellspacing=0>';
echo "n";
echo '<tr><td><font style="'.$mail_text_style.'">'.$lcms['mail_name'].' <font color="red">*</font></font></td></tr>';
echo "n";
echo '<tr><td><input type="text" style="'.$mail_input_style.'" maxlength=32 size=50 name="name"></td></tr>';
echo "n";
echo '<tr><td><font style="'.$mail_text_style.'">'.$lcms['mail_mail'].' <font color="red">*</font></font></td></tr>';
echo "n";
echo '<tr><td><input type="text" style="'.$mail_input_style.'" maxlength=60 size=50 name="mail"></td></tr>';
echo "n";
echo '<tr><td><font style="'.$mail_text_style.'" >'.$lcms['mail_subject'].'</font></td></tr>';
echo "n";
echo '<tr><td><SELECT style="'.$mail_input_style.'" maxlength=32 NAME="subject">';
echo "n";
$mail_select=explode("|",$mail_select);
echo "<option value="".$mail_select[0]."" selected>>> ".$lcms['mail_choose']." <<n";
for ($q=0; $q<count($mail_select); $q++)
{
echo "<option value="".$mail_select[$q]."">".$mail_select[$q];
};
echo "</SELECT></td></tr>n";
if ($cms_secpic == 1) {
echo '<tr><td><font style="'.$mail_text_style.'">'.$lcms['security'].'<font color="red">*</font></font> <img width=100 height=30 src="'.$cms_site.'/cms.php?action=codegen&rand='.rand(1111,9999).'" border=0 alt="'.$lcms['security'].'"></td></tr>';
}
else
{
echo '<tr><td><font style="'.$mail_text_style.'">'.$lcms['security_text'].'<font color="red">*</font> '.$lcms['security_question'].'</td></tr>';
};
echo "n";
echo '<tr><td><input type="text" style="'.$mail_input_style.'" maxlength=6 size=50 name="security">';
echo "n";
echo '<tr><td><font style="'.$mail_text_style.'">'.$lcms['mail_message'].' <font color="red">*</font></font></td></tr>';
echo "n";
echo '<tr><td><textarea name="message" style="'.$mail_input_style.'" cols=50 rows=6></textarea></td></tr>';
echo "n";
echo '<tr><td align="center"><input type="submit" name="submit" value="'.$lcms['mail_submit'].'" style="'.$mail_input_style.'"> <input type="reset" style="'.$mail_input_style.'" name="reset" value="'.$lcms['mail_reset'].'"></td></tr>';
echo "n";
echo "</table></center>n";
echo "</form>n";
};
if ($action=="tomail")
{
$security = $_POST['security'];
$name = filtr($_POST['name']);
$mail = filtr($_POST['mail']);
$subject = filtr($_POST['subject']);
$message = filtr($_POST['message']);
if(!$name){echo $lcms['error_name']; exit; };
if(!$mail){echo $lcms['error_mail']; exit; };
if (!TrueEmail($mail)) { echo $lcms['error_mail']; exit; };
if(!$message){echo $lcms['error_message']; exit; };
if (chec_code($security)) { } else { echo $lcms['error_security']; exit; };
tomail($subject,$lcms['mail_name']." ".$name."n".$lcms['mail_mail']." ".$mail."n".$lcms['mail_message']." ".$message);
$message = str_replace("rn",'<br>',$message);
$message = str_replace("n",'<br>',$message);
$nm=fopen($cms_root."/data/new_messages.dat","a");
fwrite($nm,$subject."|utrh|".$lcms['mail_name']." ".$name."<br>".$lcms['date']." ".date("d.m.y")."<br>".$lcms['mail_mail']." ".$mail."<br>IP: ".$_SERVER['REMOTE_ADDR']."<br>".$lcms['mail_message']." ".$message."rn");
fclose($nm);
$nm=fopen($cms_root."/data/feedback.dat","a");
fwrite($nm, $lcms['mail_name']." ".$name."<br>".$lcms['date']." ".date("d.m.y")."<br>".$lcms['mail_mail']." ".$mail."<br>IP: ".$_SERVER['REMOTE_ADDR']."|".$message."rn");
fclose($nm);
echo '<html><head><title>'.$lcms['faq_submit_title'].'</title><meta http-equiv="content-type" content="text/html; charset=Windows-1251"><meta http-equiv="refresh" content="2;URL='.$_SERVER['HTTP_REFERER'].'"></head><style>BODY {background-color:#FFFFFF;}</style><body>';
echo '<table border=1 bordercolor="#0000A0" cellspacing=0 width=100% height=100%><tr><td align="center"><b><font style="font-family:verdana,arial,ms sans serif;font-size:12pt;" color="#0000A0">'.$lcms['faq_submit_title'].'<br><font style="font-family:verdana,arial,ms sans serif;font-size:8pt;">'.$lcms['refer1'].' <a href="'.$_SERVER['HTTP_REFERER'].'">'.$lcms['refer2'].'</a></font></font></b><br><br><br>';
HereEnd();
echo '</td></tr></table></body></html>';
};
function HereViews($id)
{
global $cms_root;
$sv_views=file($cms_root."/data/views.dat");
$sv_found=0;
$sv_line=0;
$new_view=fopen($cms_root."/data/views.dat","w");
flock($new_view,LOCK_EX);
foreach($sv_views as $sv_elemetns)
{
$sv_elemetn=trim($sv_elemetns);
$programm=explode("=",$sv_elemetn);
if ($programm[0] == $id){
$sv_tmp=$programm[1];
echo $programm[1];
$sv_found=1;
$sv_tmp+=1;
fwrite($new_view,$id."=".$sv_tmp."rn");
}
else
{
if($programm[1]!=""){
fwrite($new_view,$sv_views[$sv_line]);};
};
$sv_line+=1;
};
flock($new_view,LOCK_UN);
fclose($new_view);
};
function HereDownloads($id)
{
global $cms_root;
$sv_downloads=file($cms_root."/data/downloads.dat");
$sv_found=0;
$sv_line=0;
foreach($sv_downloads as $sv_elemetns)
{
$sv_elemetn=trim($sv_elemetns);
$programm=explode("=",$sv_elemetn);
if ($programm[0] == $id){
$sv_tmp=$programm[1];
echo $programm[1];
$sv_found=1;
$sv_tmp+=1;
};
$sv_line+=1;
};
};
function HereArchiv()
{
global $cms_root, $mess_form_style;
$newsdata = file($cms_root.'/data/archiv.dat');
$newsdata = array_reverse($newsdata);
foreach($newsdata as $element)
{
$element = trim($element);
$pieces = explode("|", $element);
echo "<font style="".$mess_form_style."">".$pieces[0]."</font>n";
echo '<img src="im/go.gif" border=0> ';
echo "n";
echo '<font style="'.$mess_form_style.'">'.$pieces[3];
echo '</font>';
echo '<br><br>';
echo "n";
}
};
function HereRotator()
{
global $cms_root;
include($cms_root."/data/rotator.tpl");
$url_list = file($cms_root."/data/rotator.dat");
$last = file($cms_root."/data/last_rotator.dat");
$last = $last[0];
if (count($url_list)==0){
exit;
};
if ($last >= (count($url_list) - 1)) {
$last=0;
}
else
{
$last = $last + 1;
};
$tmp_url=explode("=",$url_list[$last]);
echo "<a style="".$rotator_img_style."" href="".$tmp_url[1]."" target="_blank"><img border=0 src="".$tmp_url[0].""></a>
";
$ll=fopen($cms_root."/data/last_rotator.dat","w");
flock($ll,LOCK_EX);
fwrite($ll,$last);
flock($ll,LOCK_UN);
fclose($ll);
};
function HereSearch()
{
global $cms_root,$cms_site,$lcms,$_GET,$_SERVER;
function tolower($content) {
$content = strtr($content, "АБВГДЕЁЖЗИЙКЛМНОРПСТУФХЦЧШЩЪЬЫЭЮЯ",
"абвгдеёжзийклмнорпстуфхцчшщъьыэюя");
return strtolower($content);
};
if (isset($_GET['text']))
{
$text = $_GET['text'];
$text = urldecode ($text);
$text = tolower($text);
$text = htmlspecialchars($text);
$text = filtr($text);
};
include($cms_root."/data/search.tpl");
echo "<br><center><form name="search" action="".$_SERVER['PHP_SELF']."" method="get">
<font style="".$search_text.""><b>".$lcms['search_search']." </b></font><input style="".$search_input."" maxlength=20 name="text" value="".$text."" type="text" size=20>
<input style="".$search_button."" type="submit" value="".$lcms['search_submit'].""></form></center><br>
";
if ($_GET['text'])
{
$search_db = file($cms_root."/data/search.dat");
//$text = filtr($text);
$found=0;
$s=0;
if (strlen($text) < 3 ){
echo "<font style="".$search_text."" color="red"><b>Ваш запрос меньше 3 символов!</b></font>";
$found=1;
}
else
{
echo "<table border=0 cellpadding=3 cellspacing=0>";
$text=chop($text);
$qu=explode(" ",$text);
for ($q=0; $q<count($qu); $q++)
{
foreach($search_db as $elements)
{
$elements=trim($elements);
$element=explode("|",$elements);
$se=tolower($element[2]);
if (strstr($se,$qu[$q]))
{
$found = 1;
$s+=1;
$search_stroka = substr($element[2],0,strpos($se,$qu[$q]))."<font style="background-color:#FFCF9F"><font style="".$search_text."">".$qu[$q]."</font></font>";
$search_stroka .= substr($element[2],strpos($se,$qu[$q])+strlen($qu[$q]));
echo "<tr><td>".$s.".</td><td><a style="".$search_text."" target="_blank" href="".$element[0]."">".$element[1]."</a></td></tr>n";
echo "<tr><td></td><td><font style="".$search_text."">".$search_stroka."</font></td></tr>n";
};
};
};
echo "</table>";
};
if ($found==0)
{
echo "<font style="".$search_text."">Ничего не найдено! Возможно, вы просто не правильно составили запрос.</font>";
}
else
{
echo "<font style="".$search_text.""><br><br>Вы искали "".$text.""<br>И нашли ".$s." документов</font>";
};
}
else
{
if (isset($_GET['text'])) {
echo "<font color="red"><font style="".$search_text.""><b>Ваш запрос меньше 3 символов!</b></font></font>";
};
};
};
function HereRecordOnline()
{
global $cms_root;
include($cms_root."/data/online.dat");
};
function HereFAQ()
{
global $cms_root,$cms_site,$lcms;
$faq_db = file($cms_root."/data/faq.dat");
$faq_db = array_reverse($faq_db);
$faq_d = 0;
include($cms_root."/data/faq.tpl");
echo "<ol>n";
foreach ($faq_db as $faq_line)
{
$faq_d++;
$mini = explode("|",$faq_line);
if ($mini[3]=="show")
{
echo "<li><a style="".$faq_link."" href="#".$faq_d."">".substr($mini[4],0,65)."...</a>n";
};
};
echo "</OL>n<br><br>n<table width=100%>n";
$faq_d = 0;
foreach ($faq_db as $faq_line)
{
$faq_d++;
$mini = explode("|",$faq_line);
if ($mini[3]=="show")
{
echo "<tr><td align=left><a name="".$faq_d.""></a><img src="im/vopros.gif" border=0><font style="".$faq_title.""> ".$lcms['faq_question']." ".$mini[0].":</font></td><td align=right><font style="".$faq_date."">".$mini[2]."</font></td></tr>n";
echo "<tr><td colspan=2><font style="".$faq_question."">".$mini[4]."</font></td></tr>n";
echo "<tr><td colspan=2><img src="im/otvet.gif" border=0><font style="".$faq_title.""> ".$lcms['faq_answer']." ".$mini[5]."</font></td></tr>n";
echo "<tr><td colspan=2><font style="".$faq_answer."">".$mini[6]."</font><hr color="#DDDDFF" size=1 width=50%></td></tr>n";
};
};
echo "</table>n";
};
function HereQuestion()
{
global $cms_root,$cms_site,$lcms,$cms_secpic;
include($cms_root."/data/faq.tpl");
echo '<form name="send_faq" action="'.$cms_site.'/cms.php?action=question" method="post">';
echo "n";
echo '<center><table border=0 cellpadding=3 cellspacing=0>';
echo "n";
echo '<tr><td><font style="'.$faq_question.'">'.$lcms['faq_name'].' <font color="red">*</font></font></td></tr>';
echo "n";
echo '<tr><td><input type="text" style="'.$faq_question.'" maxlength=32 size=50 name="name"></td></tr>';
echo "n";
echo '<tr><td><font style="'.$faq_question.'">'.$lcms['faq_mail'].' <font color="red">*</font></font></td></tr>';
echo "n";
echo '<tr><td><input type="text" style="'.$faq_question.'" maxlength=60 size=50 name="mail"></td></tr>';
echo "n";
if ($cms_secpic == 1) {
echo '<tr><td><font style="'.$faq_question.'">'.$lcms['security'].' <font color="red">*</font> <img src="'.$cms_site.'/cms.php?action=codegen&rand='.rand(1111,9999).'" width100 height=30 border=0 alt="'.$lcms['security'].'"></font></td></tr>';
}
else
{
echo '<tr><td><font style="'.$faq_question.'">'.$lcms['security_text'].' <font color="red">*</font> '.$lcms['security_question'].'</font></td></tr>';
};
echo "n";
echo '<tr><td><input type="text" style="'.$faq_question.'" maxlength=6 size=50 name="security">';
echo "n";
echo '<tr><td><font style="'.$faq_question.'">'.$lcms['faq_message'].'<font color="red">*</font></font></td></tr>';
echo "n";
echo '<tr><td><textarea name="message" style="'.$faq_question.'" cols=50 rows=6></textarea></td></tr>';
echo "n";
echo '<tr><td align="center"><input type="submit" name="submit" value="'.$lcms['faq_submit'].'" style="'.$faq_question.'"> <input type="reset" style="'.$faq_question.'" name="reset" value="'.$lcms['faq_reset'].'"></td></tr>';
echo "n";
echo "</table></center>n";
echo "</form>n";
};
if ($action=="question")
{
$security = $_POST['security'];
$name = filtr($_POST['name']);
$mail = filtr($_POST['mail']);
$message = filtr($_POST['message']);
if (!chec_code($security)) { echo $lcms['error_security']; exit; };
if (!$name) { echo $lcms['error_name']; exit; };
if (!TrueEmail($mail)) { echo $lcms['error_mail']; exit; };
if (!$message) { echo $lcms['error_message']; exit; };
if(strstr($_POST['name'],"|"))
{
echo $lcms['serror_name'];
exit;
}
if(strstr($_POST['message'],"|"))
{
echo $lcms['serror_message'];
exit;
}
$date = date("d.m.y, H:i");
$ip = $_SERVER['REMOTE_ADDR'];
$message = str_replace("rn","<br>",$message);
$fp = fopen($cms_root.'/data/faq.dat','a');
$line = $name."|".$mail."|".$date."|hide|".$message."|".$lcms['faq_admin']."|".$lcms['faq_no'];
$line = str_replace("rn","<BR>",$line);
$line .= "rn";
fputs($fp, "$line");
fclose($fp);
$subject = $lcms['faq_subject'];
tomail($subject,$lcms['faq_name']." ".$name."n".$lcms['faq_mail']." ".$mail."nIP: ".$ip."n".$lcms['faq_message']." ".$message);
$nm=fopen($cms_root."/data/new_messages.dat","a");
fwrite($nm,$subject."|no|".$lcms['faq_name']." ".$name."<br>".$lcms['date']." ".date("d.m.y")."<br>".$lcms['faq_mail']." ".$mail."<br>IP: ".$_SERVER['REMOTE_ADDR']."<br>".$lcms['faq_message']." ".$message."rn");
fclose($nm);
echo '<html><head><title>'.$lcms['faq_submit_title'].'</title><meta http-equiv="content-type" content="text/html; charset=Windows-1251"><meta http-equiv="refresh" content="2;URL='.$_SERVER['HTTP_REFERER'].'"></head><style>BODY {background-color:#FFFFFF;}</style><body>';
echo '<table border=1 bordercolor="#0000A0" cellspacing=0 width=100% height=100%><tr><td align="center"><b><font style="font-family:verdana,arial,ms sans serif;font-size:12pt;" color="#0000A0">'.$lcms['faq_submit_title'].'<br><font style="font-family:verdana,arial,ms sans serif;font-size:8pt;">'.$lcms['refer1'].' <a href="'.$_SERVER['HTTP_REFERER'].'">'.$lcms['refer2'].'</a></font></font></b><br><br><br>';
HereEnd();
echo '</td></tr></table></body></html>';
};
function HereBlog()
{
global $cms_root,$cms_site,$rec_page,$_GET,$_SERVER,$_POST,$lcms,$cms_premoder,$cms_secpic;
include($cms_root."/data/blog.tpl");
if (isset($_GET['comment']))
{
$comment = filtr($_GET['comment']);
$comment = str_replace(".","",$comment);
}
else
{
$comment = "bla_bla";
}
if (($comment) && (file_exists($cms_root."/data/blog/".$comment.".txt")))
{
$blogs = file($cms_root."/data/blog/".$comment.".txt");
$blog = explode("|",$blogs[0]);
$all = count($blogs)-1;
echo "<center><font style="".$blog_title."">".$blog[2]."</font></center>n";
echo "<br><font style="".$blog_message."">".$blog[3]."</font>n";
echo "<table border=0 width="100%" cellpadding=2 cellspacing=0>n";
echo "<tr><td style="".$blog_down.""><font style="".$blog_comment."">".$lcms['blog_author']." <b>".$blog[1]."</b> | ".$lcms['blog_added']." <b>".$blog[0]."</b> | ".$lcms['blog_nast']." <b>".$blog[4]."</b></font></td></tr>n";
echo "</table><br>n";
echo "<table bgcolor="#FBFBFF" border=0 cellpadding=2 cellspacing=0 width="100%">n";
for ($tmp=1;$tmp<count($blogs);$tmp++)
{
$new_blogs[]=$blogs[$tmp];
};
$gb_count=count($new_blogs);
$page=1;
if (isset($_GET['page'])) {
if (($_GET['page']>0) and ($_GET['page']<=ceil($gb_count/$rec_page))) $page=$_GET['page'];
}
$gb_j = ($gb_count-1)-(($page-1)*$rec_page);
$gb_i = $gb_j-$rec_page;
$gb_i_ = $gb_j-$rec_page;
$gb_all = ceil($gb_count/$rec_page);
echo "<tr><td colspan=2><center><font style="".$blog_message."">[ ".$lcms['gb_pages']." ";
for ($gb_i_=1; $gb_i_<=$gb_all;$gb_i_++) {
if ($page==$gb_i_) { echo "[".$gb_i_."] ";
}
else
{ echo '<a href="?comment='.$comment.'&page='.$gb_i_.'">'.$gb_i_.'</a> ';};}
echo ']</font></center></td></tr>';
//$all=$page/$rec_page+$all;
for (; $gb_i<$gb_j && $gb_j>=0; $gb_j--) {
$blog = explode("|",$new_blogs[$gb_j]);
if ($cms_premoder == 1) {
if ($blog[6] == "yes") {
$show_blog_comment = 1;
}
else {
$show_blog_comment = 0;
};
}
else {
$show_blog_comment = 1;
};
if ($show_blog_comment == 1) {
echo "<tr><td align=left><font style="".$blog_comment.""><b>".$blog[1]."</b></font></td><td align=right><font style="".$blog_comment."">".$blog[0]."</font></td></tr>n";
echo "<tr><td colspan=2><font style="".$blog_message."">".$blog[3]."</font></td></tr>n";
};
//$all=$all-1;
}
echo '<tr><td colspan=2><center><font style="'.$blog_message.'">[ '.$lcms['gb_pages'].' ';
for ($gb_i=1; $gb_i<=$gb_all;$gb_i++) {
if ($page==$gb_i) { echo "[".$gb_i."] ";
} else { echo '<a href="?comment='.$comment.'&page='.$gb_i.'">'.$gb_i.'</a> ';};
}
echo ']</font></center></td></tr>';
echo "</table><br><a href="".$_SERVER['PHP_SELF']."">".$lcms['blog_back']."</a><br>n";
echo "<br><center><form name="post" action="".$cms_site."/cms.php?action=add_comment&comment=".$comment."" method="post"><table border=0 cellpadding=3 cellspacing=0>n";
echo "<tr><td width="50%"><font style="".$blog_message."">".$lcms['blog_name']."<font color="red">*</font></td><td colspan=2><input type="text" style="".$blog_message."" name="name" size=24 maxlength=32></td></tr>n";
echo "<tr><td width="50%"><font style="".$blog_message."">".$lcms['blog_mail']."<font color="red">*</font></td><td colspan=2><input type="text" name="mail" style="".$blog_message."" size=24 maxlength=60></td></tr>n";
if ($cms_secpic == 1) {
echo "<tr><td width="50%"><font style="".$blog_message."">".$lcms['security']."<font color="red">*</font></td><td align="center"><img src="".$cms_site."/cms.php?action=codegen&rand=".rand(1111,9999)."" alt="".$lcms['security']."" width=100 height=30 border=0></td>n<td><input type="text" name="security" style="".$blog_message."" size=4 maxlength=4></td></tr>n";
}
else
{
echo "<tr><td width="50%"><font style="".$blog_message."">".$lcms['security_text']."<font color="red">*</font></td><td align="center"><font style="".$blog_message."">".$lcms['security_question']."</font></td>n<td><input type="text" name="security" style="".$blog_message."" size=4 maxlength=4></td></tr>n";
};
echo '<tr><td align="center" colspan=3>'
.' <img src="'.$cms_site.'/im/1.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[1]';">'
.' <img src="'.$cms_site.'/im/14.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=';)';">'
.' <img src="'.$cms_site.'/im/13.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=':D';">'
.' <img src="'.$cms_site.'/im/2.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=':)';">'
.' <img src="'.$cms_site.'/im/9.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[9]';">'
.' <img src="'.$cms_site.'/im/19.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[19]';">'
.' <img src="'.$cms_site.'/im/17.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=':p';">'
.' <img src="'.$cms_site.'/im/8.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=':(';">'
.' <img src="'.$cms_site.'/im/3.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[3]';">'
.' <img src="'.$cms_site.'/im/5.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[5]';"><br>'
.' <img src="'.$cms_site.'/im/11.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[11]';">'
.' <img src="'.$cms_site.'/im/12.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[12]';">'
.' <img src="'.$cms_site.'/im/15.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[15]';">'
.' <img src="'.$cms_site.'/im/16.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+=';(';">'
.' <img src="'.$cms_site.'/im/18.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[18]';">'
.' <img src="'.$cms_site.'/im/7.gif" border=0 style="cursor:hand;" onClick="document.post.message.value+='[7]';">'
.' <input type="button" value="'.$lcms['gb_b'].'" style="font-weight:bold" onClick="document.post.message.value+='[b][/b]';">'
.' <input type="button" value="'.$lcms['gb_i'].'" style="font-style:italic" onClick="document.post.message.value+='[i][/i]';">'
.' <input type="button" value="'.$lcms['gb_u'].'" style="text-decoration:underline" onClick="document.post.message.value+='[u][/u]';">'
.'</td></tr>';
echo "<tr><td colspan=3 align="left"><font style="".$blog_message."">".$lcms['blog_message']."<font color="red">*</font><br><textarea style="".$blog_message."" name="message" cols=50 rows=8></textarea></td></tr>n";
echo "<tr><td colspan=3 align="center"><input type="submit" name="submit" value="".$lcms['blog_submit'].""></td></tr>";
echo "</table></form></center>";
}
else
{
$blogs = file($cms_root."/data/blog/list.txt");
$blogs = array_reverse($blogs);
foreach ($blogs as $blog_)
{
$blog = explode("|",$blog_);
$massiv[]=$blog_;
$file = $blog[6];
$all = count(file($cms_root."/data/blog/".$file.".txt"))-1;
echo "<center><a href="?comment=".str_replace(".txt","",$file)."" style="".$blog_title."">".$blog[2]."</a></center>n";
echo "<br><font style="".$blog_message."">".$blog[3]."</font>n";
echo "<table border=0 width="100%" cellpadding=2 cellspacing=0>n";
echo "<tr><td style="".$blog_down.""><font style="".$blog_comment."">".$lcms['blog_author']." <b>".$blog[1]."</b> | ".$lcms['blog_added']." <b>".$blog[0]."</b> | ".$lcms['blog_nast']." <b>".$blog[4]."</b> | <a style="".$blog_link."" href="?comment=".str_replace(".txt","",$file)."">".$lcms['blog_comment']." (".$all.")</a></font></td></tr>n";
echo "</table>n";
};
echo "<br><br>".$lcms['blog_all']." ".count($massiv);
};
};
if ($action=="add_comment")
{
$security = $_POST['security'];
$name = filtr($_POST['name']);
$mail = filtr($_POST['mail']);
$comment = filtr($_GET['comment']);
$comment = str_replace(".","",$comment);
$message = filtr($_POST['message']);
$date = date("d.m.y, H:i");
$ip = $_SERVER['REMOTE_ADDR'];
$message = str_replace("[b]","<b>",$message);
$message = str_replace("[/b]","</b>",$message);
$message = str_replace("[i]","<i>",$message);
$message = str_replace("[/i]","</i>",$message);
$message = str_replace("[u]","<u>",$message);
$message = str_replace("[/u]","</u>",$message);
$message = str_replace("[1]",'<img src="'.$cms_site.'/im/1.gif" border=0>',$message);
$message = str_replace("[2]",'<img src="'.$cms_site.'/im/2.gif" border=0>',$message);
$message = str_replace("[3]",'<img src="'.$cms_site.'/im/3.gif" border=0>',$message);
$message = str_replace("[4]",'<img src="'.$cms_site.'/im/4.gif" border=0>',$message);
$message = str_replace("[5]",'<img src="'.$cms_site.'/im/5.gif" border=0>',$message);
$message = str_replace("[6]",'<img src="'.$cms_site.'/im/6.gif" border=0>',$message);
$message = str_replace("[7]",'<img src="'.$cms_site.'/im/7.gif" border=0>',$message);
$message = str_replace("[8]",'<img src="'.$cms_site.'/im/8.gif" border=0>',$message);
$message = str_replace("[9]",'<img src="'.$cms_site.'/im/9.gif" border=0>',$message);
$message = str_replace("[10]",'<img src="'.$cms_site.'/im/10.gif" border=0>',$message);
$message = str_replace("[11]",'<img src="'.$cms_site.'/im/11.gif" border=0>',$message);
$message = str_replace("[12]",'<img src="'.$cms_site.'/im/12.gif" border=0>',$message);
$message = str_replace("[13]",'<img src="'.$cms_site.'/im/13.gif" border=0>',$message);
$message = str_replace("[14]",'<img src="'.$cms_site.'/im/14.gif" border=0>',$message);
$message = str_replace("[15]",'<img src="'.$cms_site.'/im/15.gif" border=0>',$message);
$message = str_replace("[16]",'<img src="'.$cms_site.'/im/16.gif" border=0>',$message);
$message = str_replace("[17]",'<img src="'.$cms_site.'/im/17.gif" border=0>',$message);
$message = str_replace("[18]",'<img src="'.$cms_site.'/im/18.gif" border=0>',$message);
$message = str_replace("[19]",'<img src="'.$cms_site.'/im/19.gif" border=0>',$message);
$message = str_replace("=)",'<img src="'.$cms_site.'/im/2.gif" border=0>',$message);
$message = str_replace(":)",'<img src="'.$cms_site.'/im/2.gif" border=0>',$message);
$message = str_replace(":-)",'<img src="'.$cms_site.'/im/2.gif" border=0>',$message);
$message = str_replace(":p",'<img src="'.$cms_site.'/im/17.gif" border=0>',$message);
$message = str_replace(":D",'<img src="'.$cms_site.'/im/13.gif" border=0>',$message);
$message = str_replace(";)",'<img src="'.$cms_site.'/im/14.gif" border=0>',$message);
$message = str_replace(";-)",'<img src="'.$cms_site.'/im/14.gif" border=0>',$message);
$message = str_replace(":(",'<img src="'.$cms_site.'/im/8.gif" border=0>',$message);
$message = str_replace(";(",'<img src="'.$cms_site.'/im/16.gif" border=0>',$message);
$message = str_replace(";-(",'<img src="'.$cms_site.'/im/16.gif" border=0>',$message);
$message = str_replace("=(",'<img src="'.$cms_site.'/im/8.gif" border=0>',$message);
$message = str_replace(":-(",'<img src="'.$cms_site.'/im/8.gif" border=0>',$message);
$message = str_replace("rn","<br>",$message);
if ($_POST['submit'])
{
if (chec_code($security))
{
if (!$name) { echo $lcms['error_name']; exit; };
if (!$message) { echo $lcms['error_message']; exit; };
if (!TrueEmail($mail)) { echo $lcms['error_mail']; exit; };
$mail = str_replace("@","[собако]",$mail);
if (strstr($name,"|")) { echo $lcms['error_name']; exit; };
if (strstr($message,"|")) { echo $lcms['error_message']; exit; };
if ($cms_domref==1){
if (!eregi($cms_site, $_SERVER['HTTP_REFERER'])) { echo $lcms['error_domref']; exit; };
};
if (file_exists($cms_root."/data/blog/".$comment.".txt"))
{
$file = fopen($cms_root."/data/blog/".$comment.".txt","a");
if ($cms_premoder==1) {
$premoderacia="no";
}
else {
$premoderacia="yes";
};
$line = $date."|".$name."|".$mail."|".$message."||".$ip."|".$premoderacia."|";
$line = str_replace("rn","<BR>",$line);
$line .= "rn";
fputs($file, $line);
fclose($file);
$subject = $lcms['blog_subject'];
tomail($subject,$lcms['blog_name']." ".$name."n".$lcms['blog_mail']." ".$mail."n".$lcms['blog_message']." ".$message);
$nm=fopen($cms_root."/data/new_messages.dat","a");
fwrite($nm,$subject."|".$premoderacia."|".$lcms['blog_name']." ".$name."<br>".$lcms['date']." ".date("d.m.y")."<br>".$lcms['blog_mail']." ".$mail."<br>IP: ".$_SERVER['REMOTE_ADDR']."<br>".$lcms['blog_message']." ".$message."rn");
fclose($nm);
echo '<html><head><title>'.$lcms['blog_submit_title'].'</title><meta http-equiv="content-type" content="text/html; charset=Windows-1251"><meta http-equiv="refresh" content="2;URL='.$_SERVER['HTTP_REFERER'].'"></head><style>BODY {background-color:#FFFFFF;}</style><body>';
echo '<table border=1 bordercolor="#0000A0" cellspacing=0 width=100% height=100%><tr><td align="center"><b><font style="font-family:verdana,arial,ms sans serif;font-size:12pt;" color="#0000A0">'.$lcms['blog_submit_title'].'<br><font style="font-family:verdana,arial,ms sans serif;font-size:8pt;">'.$lcms['refer1'].' <a href="'.$_SERVER['HTTP_REFERER'].'">'.$lcms['refer2'].'</a></font></font></b><br><br><br>';
HereEnd();
echo '</td></tr></table></body></html>';
}
else
{
echo $lcms['hack'];
exit;
}
}
else
{
echo $lcms['error_security'];
exit;
};
}
else
{
echo $lcms['hack'];
exit;
};
};
if ($action=="add_comment_news")
{
$security = $_POST['security'];
$name = filtr($_POST['name']);
$mail = filtr($_POST['mail']);
$title_news = filtr($_POST['title_news']);
$comment = filtr($_GET['comment']);
$comment = str_replace(".","",$comment);
$message = filtr($_POST['message']);
$date = date("d.m.y, H:i");
$ip = $_SERVER['REMOTE_ADDR'];
$message = str_replace("[b]","<b>",$message);
$message = str_replace("[/b]","</b>",$message);
$message = str_replace("[i]","<i>",$message);
$message = str_replace("[/i]","</i>",$message);
$message = str_replace("[u]","<u>",$message);
$message = str_replace("[/u]","</u>",$message);
$message = str_replace("[1]",'<img src="'.$cms_site.'/im/1.gif" border=0>',$message);
$message = str_replace("[2]",'<img src="'.$cms_site.'/im/2.gif" border=0>',$message);
$message = str_replace("[3]",'<img src="'.$cms_site.'/im/3.gif" border=0>',$message);
$message = str_replace("[4]",'<img src="'.$cms_site.'/im/4.gif" border=0>',$message);
$message = str_replace("[5]",'<img src="'.$cms_site.'/im/5.gif" border=0>',$message);
$message = str_replace("[6]",'<img src="'.$cms_site.'/im/6.gif" border=0>',$message);
$message = str_replace("[7]",'<img src="'.$cms_site.'/im/7.gif" border=0>',$message);
$message = str_replace("[8]",'<img src="'.$cms_site.'/im/8.gif" border=0>',$message);
$message = str_replace("[9]",'<img src="'.$cms_site.'/im/9.gif" border=0>',$message);
$message = str_replace("[10]",'<img src="'.$cms_site.'/im/10.gif" border=0>',$message);
$message = str_replace("[11]",'<img src="'.$cms_site.'/im/11.gif" border=0>',$message);
$message = str_replace("[12]",'<img src="'.$cms_site.'/im/12.gif" border=0>',$message);
$message = str_replace("[13]",'<img src="'.$cms_site.'/im/13.gif" border=0>',$message);
$message = str_replace("[14]",'<img src="'.$cms_site.'/im/14.gif" border=0>',$message);
$message = str_replace("[15]",'<img src="'.$cms_site.'/im/15.gif" border=0>',$message);
$message = str_replace("[16]",'<img src="'.$cms_site.'/im/16.gif" border=0>',$message);
$message = str_replace("[17]",'<img src="'.$cms_site.'/im/17.gif" border=0>',$message);
$message = str_replace("[18]",'<img src="'.$cms_site.'/im/18.gif" border=0>',$message);
$message = str_replace("[19]",'<img src="'.$cms_site.'/im/19.gif" border=0>',$message);
$message = str_replace("=)",'<img src="'.$cms_site.'/im/2.gif" border=0>',$message);
$message = str_replace(":)",'<img src="'.$cms_site.'/im/2.gif" border=0>',$message);
$message = str_replace(":-)",'<img src="'.$cms_site.'/im/2.gif" border=0>',$message);
$message = str_replace(":p",'<img src="'.$cms_site.'/im/17.gif" border=0>',$message);
$message = str_replace(":D",'<img src="'.$cms_site.'/im/13.gif" border=0>',$message);
$message = str_replace(";)",'<img src="'.$cms_site.'/im/14.gif" border=0>',$message);
$message = str_replace(";-)",'<img src="'.$cms_site.'/im/14.gif" border=0>',$message);
$message = str_replace(":(",'<img src="'.$cms_site.'/im/8.gif" border=0>',$message);
$message = str_replace(";(",'<img src="'.$cms_site.'/im/16.gif" border=0>',$message);
$message = str_replace(";-(",'<img src="'.$cms_site.'/im/16.gif" border=0>',$message);
$message = str_replace("=(",'<img src="'.$cms_site.'/im/8.gif" border=0>',$message);
$message = str_replace(":-(",'<img src="'.$cms_site.'/im/8.gif" border=0>',$message);
$message = str_replace("rn","<br>",$message);
if ($_POST['submit'])
{
if (chec_code($security))
{
if (!$name) { echo $lcms['error_name']; exit; };
if (!$message) { echo $lcms['error_message']; exit; };
if (!TrueEmail($mail)) { echo $lcms['error_mail']; exit; };
$mail = str_replace("@","[собако]",$mail);
if (strstr($name,"|")) { echo $lcms['error_name']; exit; };
if (strstr($message,"|")) { echo $lcms['error_message']; exit; };
if ($cms_domref==1){
if (!eregi($cms_site, $_SERVER['HTTP_REFERER'])) { echo $lcms['error_domref']; exit; };
};
if (file_exists($cms_root."/data/news/".$comment.".txt"))
{
$file = fopen($cms_root."/data/news/".$comment.".txt","a");
if ($cms_premoder==1) {
$premoderacia="no";
}
else {
$premoderacia="yes";
};
$line = $date."|".$name."|".$mail."|".$message."||".$ip."|".$premoderacia."|";
$line = str_replace("rn","<BR>",$line);
$line .= "rn";
fputs($file, $line);
fclose($file);
$subject = $lcms['news_subject'];
tomail($subject,"Название новости: ".$title_news."n".$lcms['news_name']." ".$name."n".$lcms['news_mail']." ".$mail."n".$lcms['news_message']." ".$message);
$nm=fopen($cms_root."/data/new_messages.dat","a");
fwrite($nm,$subject."|".$premoderacia."|"."Название новости: ".$title_news."<br>".$lcms['news_name']." ".$name."<br>".$lcms['date']." ".date("d.m.y")."<br>".$lcms['news_mail']." ".$mail."<br>IP: ".$_SERVER['REMOTE_ADDR']."<br>".$lcms['news_message']." ".$message."rn");
fclose($nm);
echo '<html><head><title>'.$lcms['news_submit_title'].'</title><meta http-equiv="content-type" content="text/html; charset=Windows-1251"><meta http-equiv="refresh" content="2;URL='.$_SERVER['HTTP_REFERER'].'"></head><style>BODY {background-color:#FFFFFF;}</style><body>';
echo '<table border=1 bordercolor="#0000A0" cellspacing=0 width=100% height=100%><tr><td align="center"><b><font style="font-family:verdana,arial,ms sans serif;font-size:12pt;" color="#0000A0">'.$lcms['news_submit_title'].'<br><font style="font-family:verdana,arial,ms sans serif;font-size:8pt;">'.$lcms['refer1'].' <a href="'.$_SERVER['HTTP_REFERER'].'">'.$lcms['refer2'].'</a></font></font></b><br><br><br>';
HereEnd();
echo '</td></tr></table></body></html>';
}
else
{
echo $lcms['hack'];
exit;
}
}
else
{
echo $lcms['error_security'];
exit;
};
}
else
{
echo $lcms['hack'];
exit;
};
};
?>