Файл: function.php
Строк: 1005
<?php
function filtr_null_byte($var)
{
return str_replace(chr(0), '', $var);
}
$_GET = array_map('filtr_null_byte', $_GET);
$_POST = array_map('filtr_null_byte', $_POST);
$_COOKIE = array_map('filtr_null_byte', $_COOKIE);
$_REQUEST = array_map('filtr_null_byte', $_REQUEST);
//-------------функция микросекунд-------------//
function getmicrotime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
//-------------функция определения правильного размера-------------//
function get_size($size)
{
if ($size < 1024) $size = $size . 'Bt';
if ($size > 1024 and $size < 1048576) $size = round($size / 1024, 1) . 'Kb';
if ($size >= 1048576) $size = round(($size / 1024) / 1024, 1) . 'Mb';
return $size;
}
//-------------функция перевода секунд в дни-------------//
function makestime($string)
{
$day = floor($string / 86400);
$hours = floor(($string / 3600) - $day * 24);
$min = floor(($string - $hours * 3600 - $day * 86400) / 60);
$sec = $string - ($min * 60 + $hours * 3600 + $day * 86400);
return sprintf("%01d дн %02d час %02d мин %02d сек", $day, $hours, $min, $sec);
}
//-------------функция перевода секунд во время-------------//
function maketime($string)
{
if ($string < 3600) {
$string = sprintf("%02d:%02d", (int)($string / 60) % 60, $string % 60);
} else {
$string = sprintf("%02d:%02d:%02d", (int)($string / 3600) % 24, (int)($string / 60) % 60, $string % 60);
}
return $string;
}
// --------------- Функция правильного вывода времени -------------------//
function formattime($file_time)
{
if ($file_time >= 86400) {
$file_time = 'суток: ' . round((($file_time / 60) / 60) / 24, 1);
} elseif ($file_time >= 3600) {
$file_time = 'часов: ' . round(($file_time / 60) / 60, 1);
} elseif ($file_time >= 60) {
$file_time = 'минут: ' . round($file_time / 60);
} else {
$file_time = 'секунд: ' . round($file_time);
}
return $file_time;
}
//-------------Функция правильного вычитания-------------//
function minus($all, $minus) {
$all -= $minus;
if (0 > $all) $all = 0;
return $all;
}
//-------------Функция склонения чисел-------------//
function plural($n, $form1, $form2, $form5)
{
$n = abs($n) % 100;
$n1 = $n % 10;
if ($n > 10 && $n < 20) return $form5;
if ($n1 > 1 && $n1 < 5) return $form2;
if ($n1 == 1) return $form1;
return $form5;
}
//-------------Функция текстовой каптчи-------------//
function captcha($var)
{
$var = strtr($var, array(0 => 'ноль ',
1 => 'один ',
2 => 'два ',
3 => 'три ',
4 => 'четыре ',
5 => 'пять ',
6 => 'шесть ',
7 => 'семь ',
8 => 'восемь ',
9 => 'девять '));
return $var;
}
/*---------Время по часовому поясу---------*/
$time = ((time() - 3 * 60 * 60) + 120 * 60);
//------------------ Функция определения реального IP --------------------//
require_once 'class_ipinit.php';
$ipinit = new ipinit();
$ipl = $ipinit->ip;
$ipp = long2ip($ipl);
unset($ipinit);
//------------------ Функция определения реального браузера --------------------//
if (empty($_SESSION['user_brow'])){
if (isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA'])) {
$agent = $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'];
} elseif (isset($_SERVER['HTTP_USER_AGENT'])) {
$agent = $_SERVER['HTTP_USER_AGENT'];
} else {
$agent = 'Not_detected';
}
$agent = preg_replace('|http://|i','', $agent);
$agent = strtok($agent,'( ');
$_SESSION['user_brow'] = substr($agent, 0, 22);
}
$agent = check($_SESSION['user_brow']);
//-------------Функция времени-------------//
function vrem($time = NULL)
{
global $id, $time;
if ($time == NULL) $time = time();
if (isset($id)) $time = $time + 120 * 60 * 60;
$timep = date("j M Y в H:i", $time);
$time_p[0] = date("j n Y", $time);
$time_p[1] = date("H:i", $time);
if ($time_p[0] == date("j n Y")) $timep = date("H:i:s", $time);
if (isset($id)) {
if ($time_p[0] == date("j n Y", time() + 120 * 60 * 60)) $timep = date("H:i:s", $time);
if ($time_p[0] == date("j n Y", time() - 60 * 60 * (24 - 120))) $timep = "Вчера в $time_p[1]";
}
else
{
if ($time_p[0] == date("j n Y")) $timep = date("H:i:s", $time);
if ($time_p[0] == date("j n Y", time() - 60 * 60 * 24)) $timep = "Вчера в $time_p[1]";}
$timep = str_replace("Jan","Янв", $timep);
$timep = str_replace("Feb","Фев", $timep);
$timep = str_replace("Mar","Марта", $timep);
$timep = str_replace("May","Мая", $timep);
$timep = str_replace("Apr","Апр", $timep);
$timep = str_replace("Jun","Июня", $timep);
$timep = str_replace("Jul","Июля", $timep);
$timep = str_replace("Aug","Авг", $timep);
$timep = str_replace("Sep","Сент", $timep);
$timep = str_replace("Oct","Окт", $timep);
$timep = str_replace("Nov","Ноября", $timep);
$timep = str_replace("Dec","Дек", $timep);
return $timep;
}
//-------------Принудительно вырубаем глобальные переменные-------------//
if (ini_get('register_globals')) {
$allowed = array('_ENV' => 1, '_GET' => 1, '_POST' => 1, '_COOKIE' => 1, '_FILES' => 1, '_SERVER' => 1, '_REQUEST' => 1, 'GLOBALS' => 1);
foreach ($GLOBALS as $key => $value) {
if (!isset($allowed[$key])) {
unset($GLOBALS[$key]);
}
}
}
//-------------функция фильтра-------------//
function filtr($a)
{
$text1 = array("rn", "n");
$text2 = array(" ", " ");
$a = trim(htmlspecialchars(stripslashes(str_replace($text1, $text2, $a))));
return $a;
}
//-------------функция антимата-------------//
function mat($str)
{
include_once 'censure.php';
$censure = censure($str);
if ($censure)
{
$str = preg_replace('/[(.*)]/siu', '<span style="color: #FF0000;"><b>[censored]</b></span>', $censure);
return $str;
}
else return $str;
}
//-------------воспомагательная функция линков-------------//
function url_replace($m)
{
if (!isset($m[3])) {
return '<a href="/link.php?link=' . base64_encode($m[1]) . '">' . $m[2] . '</a>';
} else {
return '<a href="/link.php?link=' . base64_encode($m[3]) . '">' . $m[3] . '</a>';
}
}
//-------------функция подсветки PHP-кода-------------//
function highlight($code)
{
$code = strtr($code, array('<br />' => "rn", '<br/>' => "rn", '<' => '<', '>' => '>', '&' => '&', '$' => '$', '"' => '"', ''' => "'", '\' => '\', '`' => '`', '%' => '%', '^' => '^'));
if (!strpos($code, '<?') && mb_substr($code, 0, 2, 'UTF8') != '<?')
{
$code = "<?phprn" . trim($code) . "rn?>";
}
$code = highlight_string($code, true);
$code = strtr($code, array('<br />' => "rn", '<br/>' => "rn"));
$code = preg_replace('|( {2,})|', "rn1", $code);
$codeline = explode("rn", $code);
foreach($codeline as $line => $string)
{
if ($string != '') {
$ret .= '<li> ' . trim($string) . '</li>';
}
}#<span style="color:#666">' . ($line + 1) . '</span><br/>
$code = strtr($ret, array('$' => '$', "'" => ''', '\' => '\', '`' => '`', '%' => '%', '^' => '^'));
return '<div class="php"><div class="code"><ol>' . $code . '</ol></div></div>';
}
function notags($var = '') {
////////////////////////////////////////////////////////////
// Вырезание BBcode тэгов из текста //
////////////////////////////////////////////////////////////
$var = strtr($var, array (
'[green]' => '',
'[/green]' => '',
'[red]' => '',
'[/red]' => '',
'[blue]' => '',
'[/blue]' => '',
'[b]' => '',
'[/b]' => '',
'[i]' => '',
'[/i]' => '',
'[u]' => '',
'[/u]' => '',
'[s]' => '',
'[/s]' => '',
'[c]' => '',
'[/c]' => ''
));
return $var;
}
//-------------функция ББ-кодов-------------//
function bb_code($msg)
{
$msg = preg_replace('|<img src="/smiles/(.*?)" alt="(.*?)"/>|', '2', $msg);
$msg = preg_replace('#[code](.*?)[/code]#ie', "highlight('$1')", $msg);
$msg = preg_replace('#[big](.*?)[/big]#si', '<big>1</big>', $msg);
$msg = preg_replace('#[b](.*?)[/b]#si', '<b>1</b>', $msg);
$msg = preg_replace('#[i](.*?)[/i]#si', '<i>1</i>', $msg);
$msg = preg_replace('#[u](.*?)[/u]#si', '<u>1</u>', $msg);
$msg = preg_replace('#[small](.*?)[/small]#si', '<small>1</small>', $msg);
$msg = preg_replace('#[color=#([A-Z0-9]{6})](.*?)[/color]#si', '<span style="color:#1">2</span>', $msg);
$msg = preg_replace('#[q](.*?)[/q]#si', '<div class="quote">1</div>', $msg);
$msg = preg_replace('#[del](.*?)[/del]#si', '<del>1</del>', $msg);
$msg = preg_replace_callback('~\[url=(http://.+?)\](.+?)\[/url\]~', 'url_replace', $msg);
return $msg;
}
//-------------функция обратной замены ББ-кодов-------------//
function back_bb($msg)
{
$msg = preg_replace('/<br/>/si', "n", $msg);
$msg = preg_replace('/<br />/si', "n", $msg);
$msg = preg_replace('/<b>(.*?)</b>/si', '[b]1[/b]', $msg);
$msg = preg_replace('/<u>(.*?)</u>/si', '[u]1[/u]', $msg);
$msg = preg_replace('/<i>(.*?)</i>/si', '[i]1[/i]', $msg);
$msg = preg_replace('/<big>(.*?)</big>/si', '[big]1[/big]', $msg);
$msg = preg_replace('/<small>(.*?)</small>/si', '[small]1[/small]', $msg);
$msg = preg_replace('/<del>(.*?)</del>/si', '[del]1[/del]', $msg);
$msg = preg_replace('/<div class="quote">(.*?)</div>/si', '[q]1[/q]', $msg);
$msg = preg_replace('/<span style="color:#([A-Z0-9]{6})">(.*?)</span>/si', '[color=#1]2[/color]', $msg);
$msg = str_replace('<span style="color: #FF0000;">[b][censored][/b]</span>', '[censored]', $msg);
$msg = preg_replace('/<img src="/smiles/(.*?)" alt="(.*?)"/>/si', '2', $msg);
$msg = preg_replace('/<a href="/link.php?&l=http://(.*?)">(.*?)</a>/isU', '[url=http://1]2[/url]', $msg);
return $msg;
}
function PreviewGrad($var)
{
$var = user_inf($var, 'color');
if ($var == 1) $name = '<span style="background-color: #000000;"> </span><span style="background-color: #FF0000;"> </span>';
elseif ($var == 2) $name = '<span style="background-color: #000000;"> </span><span style="background-color: #00FF00;"> </span>';
elseif ($var == 3) $name = '<span style="background-color: #000000;"> </span><span style="background-color: #DDE4DA;"> </span>';
elseif ($var == 4) $name = '<span style="background-color: #000000;"> </span><span style="background-color: #0000FF;"> </span>';
elseif ($var == 5) $name = '<span style="background-color: #FF0000;"> </span><span style="background-color: #A80AEA;"> </span>';
elseif ($var == 6) $name = '<span style="background-color: #0000FF;"> </span><span style="background-color: #0ADFEC;"> </span>';
elseif ($var == 7) $name = '<span style="background-color: #FCD05B;"> </span><span style="background-color: #E665F9;"> </span>';
elseif ($var == 8) $name = '<span style="background-color: #C3C3C3;"> </span><span style="background-color: #2020EF;"> </span>';
elseif ($var == 9) $name = '<span style="background-color: #4ECF0F;"> </span><span style="background-color: #FAB600;"> </span>';
elseif ($var == 10) $name = '<span style="background-color: #F3F016;"> </span><span style="background-color: #3A2FC8;"> </span>';
elseif ($var == 11) $name = '<span style="background-color: #E80A24;"> </span><span style="background-color: #F9BB14;"> </span>';
elseif ($var == 12) $name = '<span style="background-color: #46A6F7;"> </span><span style="background-color: #0AD90A;"> </span>';
elseif ($var == 13) $name = '<span style="background-color: #EA18F7;"> </span><span style="background-color: #000000;"> </span>';
else $name = '<span style="background-color: #003A77;"> </span>';
return $name;
}
//-------------функция наложения копирайта-------------//
function img_copyright($img)
{
$copy_path = $_SERVER['DOCUMENT_ROOT'] . '/ico/copy.png';
if (isset($copy_path) && $copy_path != null && $copy = @imagecreatefromstring(file_get_contents($copy_path)))
{
$img_x = imagesx($img);
$img_y = imagesy($img);
$copy_x = imagesx($copy);
$copy_y = imagesy($copy);
$w = intval(min($img_x / 2.5, $copy_x, 128));
$h = intval(min($img_y / 2.5, $copy_y, 64));
$x_ratio = $w / $copy_x;
$y_ratio = $h / $copy_y;
if (($copy_x <= $w) && ($img_y <= $h))
{
$dstW = $copy_x;
$dstH = $copy_y;
}
elseif (($x_ratio * $copy_y) < $h)
{
$dstH = ceil($x_ratio * $copy_y);
$dstW = $w;
}
else
{
$dstW = ceil($y_ratio * $copy_x);
$dstH = $h;
}
imagecopyresampled($img, $copy, $img_x - $dstW, $img_y - $dstH, 0, 0, $dstW, $dstH, $copy_x, $copy_y);
}
return $img;
}
/*
function img_copyright($image)
{
$watermark = imagecreatefrompng('/ico/copy.png');
$position = 'right';
$alpha_level = 100;
$width = imagesx($watermark);
$height = imagesy($watermark);
if ( $position == 'right' ) {
$dest_x = imagesx($image) - $width - 5;
$dest_y = imagesy($image) - $height - 5;
} else {
$dest_x = intval(imagesx($image)*0.5) - intval($width*0.5);
$dest_y = intval(imagesy($image)*0.5) - intval($height*0.5);
}
imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $width, $height, $alpha_level);
return $image;
}
*/
//-------------функция градиента-------------//
function GradientLetter($text, $from = '', $to = '', $mode = 'hex')
{
$text = iconv('UTF-8', 'windows-1251', $text);
if ($mode == 'hex') {
$to = hexdec($to[0] . $to[1]) . ',' . hexdec($to[2] . $to[3]) . ',' . hexdec($to[4] . $to[5]);
$from = hexdec($from[0] . $from[1]) . ',' . hexdec($from[2] . $from[3]) . ',' . hexdec($from[4] . $from[5]);
}
if (empty($text)) return null;
else $levels = strlen($text);
if (empty($from)) $from = array(0, 0, 255);
else $from = explode(',', $from);
if (empty($to)) $to = array(255, 0, 0);
else $to = explode(',', $to); $output = null;
for ($i = 1; $i <= $levels; $i++) {
for ($ii = 0; $ii < 3; $ii++) {
$tmp[$ii] = $from[$ii] - $to[$ii];
$tmp[$ii] = floor($tmp[$ii] / $levels);
$rgb[$ii] = $from[$ii] - ($tmp[$ii] * $i);
if ($rgb[$ii] > 255) $rgb[$ii] = 255;
$rgb[$ii] = dechex($rgb[$ii]);
$rgb[$ii] = strtoupper($rgb[$ii]);
if (strlen($rgb[$ii]) < 2) $rgb[$ii] = 0 . $rgb[$ii];
}
$output .= '<span style="color: #'.$rgb['0'].$rgb['1'].$rgb['2'].'">'.$text[$i-1].'</span>';
}
return iconv('windows-1251', 'UTF-8', $output);
}
//-------------функции ника (вывод онлайна, фото и возраст)-------------//
function nik($ius)
{
global $user;
if (isset($ius)) $ius = intval($ius);
$result = mysql_query("SELECT `id`,`color`,`user`,`img`,`sex`,`date`,`birth` FROM `users` WHERE `id` = '$ius' LIMIT 1");
$nik = mysql_fetch_assoc($result);
if (!empty($nik['id'])) {
if ($nik['sex'] == 2) $_sex = 'М';
elseif ($nik['sex'] == 1) $_sex = 'Ж';
else $_sex = 'Не установлен';
$name = $nik['user'];
if ($nik['color'] == 1) $name = GradientLetter($name, '000000', 'FF0000');
elseif ($nik['color'] == 2) $name = GradientLetter($name, '000000', '00FF00');
elseif ($nik['color'] == 3) $name = GradientLetter($name, '000000', 'DDE4DA');
elseif ($nik['color'] == 4) $name = GradientLetter($name, '000000', '0000FF');
elseif ($nik['color'] == 5) $name = GradientLetter($name, 'FF0000', 'A80AEA');
elseif ($nik['color'] == 6) $name = GradientLetter($name, '0000FF', '0ADFEC');
elseif ($nik['color'] == 7) $name = GradientLetter($name, 'FCD05B', 'E665F9');
elseif ($nik['color'] == 8) $name = GradientLetter($name, 'C3C3C3', '2020EF');
elseif ($nik['color'] == 9) $name = GradientLetter($name, '4ECF0F', 'FAB600');
elseif ($nik['color'] == 10) $name = GradientLetter($name, 'F3F016', '3A2FC8');
elseif ($nik['color'] == 11) $name = GradientLetter($name, 'E80A24', 'F9BB14');
elseif ($nik['color'] == 12) $name = GradientLetter($name, '46A6F7', '0AD90A');
elseif ($nik['color'] == 13) $name = GradientLetter($name, 'EA18F7', '000000');
if ($nik['onl'] + 200 > time()) $_on = '<img src="/ico/online.gif" alt="on"/> ';
$BirthEx = explode('.', $nik['birth']);
$Birth = ($BirthEx[0] . '.' . $BirthEx[1] == date('j.n')) ? ' <img src="/ico/sh.gif" alt=""/>' : '';
return $_on . '<a href="/' . $nik['id'] . '">' . $name . '</a> (<b>' . $_sex . '/' . calc_age($nik['birth']) . '</b>)' . $Birth;
} else {
return 'Удален';
}
}
//-------------функции ника (с онлайном)-------------//
function us($ius)
{
global $user;
if (isset($ius)) $ius = intval($ius);
$result = mysql_query("SELECT `id`,`color`,`user`,`img`,`sex`,`date`,`birth`,`on_time` FROM `users` WHERE `id` = '$ius' LIMIT 1");
$nik = mysql_fetch_assoc($result);
if (!empty($nik['id'])) {
if ($nik['sex'] == 2) $_sex = 'М';
elseif ($nik['sex'] == 1) $_sex = 'Ж';
else $_sex = 'Не установлен';
$name = $nik['user'];
if ($nik['color'] == 1) $name = GradientLetter($name, '000000', 'FF0000');
elseif ($nik['color'] == 2) $name = GradientLetter($name, '000000', '00FF00');
elseif ($nik['color'] == 3) $name = GradientLetter($name, '000000', 'DDE4DA');
elseif ($nik['color'] == 4) $name = GradientLetter($name, '000000', '0000FF');
elseif ($nik['color'] == 5) $name = GradientLetter($name, 'FF0000', 'A80AEA');
elseif ($nik['color'] == 6) $name = GradientLetter($name, '0000FF', '0ADFEC');
elseif ($nik['color'] == 7) $name = GradientLetter($name, 'FCD05B', 'E665F9');
elseif ($nik['color'] == 8) $name = GradientLetter($name, 'C3C3C3', '2020EF');
elseif ($nik['color'] == 9) $name = GradientLetter($name, '4ECF0F', 'FAB600');
elseif ($nik['color'] == 10) $name = GradientLetter($name, 'F3F016', '3A2FC8');
elseif ($nik['color'] == 11) $name = GradientLetter($name, 'E80A24', 'F9BB14');
elseif ($nik['color'] == 12) $name = GradientLetter($name, '46A6F7', '0AD90A');
elseif ($nik['color'] == 13) $name = GradientLetter($name, 'EA18F7', '000000');
$rot = mysql_fetch_array(mysql_query("SELECT `rotate`, `block` FROM `albums` WHERE `user` = '$nik[id]' AND `type` = 'f' AND `path` = '$nik[img]'"));
if ($rot[1] == 1) $Foto = '<img src="/ico/block_photo.gif" width="35" height="35" alt=""/>';
else $Foto = '<img src="/resize.php?img='.$nik['img'].'&width=35&height=0&i='.$rot[0].'" alt=""/> ';
if ($user['avka'] == 1) {
$foto = (!empty($nik['img']))
? $Foto
: '<img src="/ico/no_avatar.gif" alt=""/> ';
}
$Hours = floor(($nik['on_time'] / 3600));
if (rat($nik['id']) >= 10 && $Hours >= 30) $med = ' <img src="/medals/b.gif" alt=""/>';
if (rat($nik['id']) >= 21 && $Hours >= 90) $med = ' <img src="/medals/s.gif" alt=""/>';
if (rat($nik['id']) >= 31 && $Hours >= 150) $med = ' <img src="/medals/g.gif" alt=""/>';
if (rat($nik['id']) >= 51 && $Hours >= 300) $med = ' <img src="/medals/br.gif" alt=""/>';
$BirthEx = explode('.', $nik['birth']);
$Birth = ($BirthEx[0] . '.' . $BirthEx[1] == date('j.n')) ? ' <img src="/ico/sh.gif" alt=""/>' : '';
return $foto . '<a href="/' . $nik['id'] . '">' . $name . '</a>' . $med . $Birth;
} else {
return 'Удален';
}
}
//-------------функции ника (с онлайном и аватаром)-------------//
function nikus($ius)
{
global $user;
if (isset($ius)) $ius = intval($ius);
$result = mysql_query("SELECT * FROM `users` WHERE `id` = '$ius' LIMIT 1");
$nik = mysql_fetch_assoc($result);
if (!empty($nik['id'])) {
if ($nik['sex'] == 2) $_sex = 'М';
elseif ($nik['sex'] == 1) $_sex = 'Ж';
else $_sex = 'Не установлен';
$gorod = mysql_fetch_array(mysql_query("SELECT `city_name` FROM `geo_cities` WHERE `city_id` = '$nik[city]' LIMIT 1"));
$name = $nik['user'];
if ($nik['color'] == 1) $name = GradientLetter($name, '000000', 'FF0000');
elseif ($nik['color'] == 2) $name = GradientLetter($name, '000000', '00FF00');
elseif ($nik['color'] == 3) $name = GradientLetter($name, '000000', 'DDE4DA');
elseif ($nik['color'] == 4) $name = GradientLetter($name, '000000', '0000FF');
elseif ($nik['color'] == 5) $name = GradientLetter($name, 'FF0000', 'A80AEA');
elseif ($nik['color'] == 6) $name = GradientLetter($name, '0000FF', '0ADFEC');
elseif ($nik['color'] == 7) $name = GradientLetter($name, 'FCD05B', 'E665F9');
elseif ($nik['color'] == 8) $name = GradientLetter($name, 'C3C3C3', '2020EF');
elseif ($nik['color'] == 9) $name = GradientLetter($name, '4ECF0F', 'FAB600');
elseif ($nik['color'] == 10) $name = GradientLetter($name, 'F3F016', '3A2FC8');
elseif ($nik['color'] == 11) $name = GradientLetter($name, 'E80A24', 'F9BB14');
elseif ($nik['color'] == 12) $name = GradientLetter($name, '46A6F7', '0AD90A');
elseif ($nik['color'] == 13) $name = GradientLetter($name, 'EA18F7', '000000');
if ($nik['onl'] + 200 > time()) $_on = '<img src="/ico/online.gif" alt="on"/> ';
$rot = mysql_fetch_array(mysql_query("SELECT `rotate`, `block` FROM `albums` WHERE `user` = '$nik[id]' AND `type` = 'f' AND `path` = '$nik[img]'"));
if ($rot[1] == 1) $Foto = '<img src="/ico/block_photo.gif" width="35" height="35" alt=""/>';
else $Foto = '<img src="/resize.php?img='.$nik['img'].'&width=35&height=0&i='.$rot[0].'" alt=""/> ';
if ($user['avka'] == 1) {
$foto = (!empty($nik['img']))
? $Foto
: '<img src="/ico/no_avatar.gif" alt=""/> ';
}
$gorod[0] = (!empty($gorod[0])) ? ', ' . $gorod[0] : ', Не указан';
$BirthEx = explode('.', $nik['birth']);
$Birth = ($BirthEx[0] . '.' . $BirthEx[1] == date('j.n')) ? ' <img src="/ico/sh.gif" alt=""/>' : '';
return $foto . '<a href="/' . $nik['id'] . '">' . $name . '</a> (<b>' . $_sex . '/' . calc_age($nik['birth']) . '</b>) ' . $gorod[0] . ' ' . $_on . $Birth;
} else {
return 'Удален';
}
}
//-------------функции цветного ника-------------//
function cvetnik($ius)
{
global $user;
if (isset($ius)) $ius = intval($ius);
$result = mysql_query("SELECT `id`, `user`, `color` FROM `users` WHERE `id` = '$ius' LIMIT 1");
$nik = mysql_fetch_assoc($result);
if (!empty($nik['id'])) {
$name = $nik['user'];
if ($nik['color'] == 1) $name = GradientLetter($name, '000000', 'FF0000');
elseif ($nik['color'] == 2) $name = GradientLetter($name, '000000', '00FF00');
elseif ($nik['color'] == 3) $name = GradientLetter($name, '000000', 'DDE4DA');
elseif ($nik['color'] == 4) $name = GradientLetter($name, '000000', '0000FF');
elseif ($nik['color'] == 5) $name = GradientLetter($name, 'FF0000', 'A80AEA');
elseif ($nik['color'] == 6) $name = GradientLetter($name, '0000FF', '0ADFEC');
elseif ($nik['color'] == 7) $name = GradientLetter($name, 'FCD05B', 'E665F9');
elseif ($nik['color'] == 8) $name = GradientLetter($name, 'C3C3C3', '2020EF');
elseif ($nik['color'] == 9) $name = GradientLetter($name, '4ECF0F', 'FAB600');
elseif ($nik['color'] == 10) $name = GradientLetter($name, 'F3F016', '3A2FC8');
elseif ($nik['color'] == 11) $name = GradientLetter($name, 'E80A24', 'F9BB14');
elseif ($nik['color'] == 12) $name = GradientLetter($name, '46A6F7', '0AD90A');
elseif ($nik['color'] == 13) $name = GradientLetter($name, 'EA18F7', '000000');
return $name;
} else {
return 'Удален';
}
}
//-------------функции зодиака-------------//
function zodiak($birth)
{
$birth = explode('.', $birth);
$d = $birth[0];
$m = $birth[1];
$g = $birth[2];
if ($d != NULL and $m != NULL and $g != NULL) {
if ($m == 1);
elseif ($m == 2);
elseif ($m == 3);
elseif ($m == 4);
elseif ($m == 5);
elseif ($m == 6);
elseif ($m == 7);
elseif ($m == 8);
elseif ($m == 9);
elseif ($m == 10);
elseif ($m == 11);
elseif ($m == 12);
$birth = date('Y')-$g;
if (date('n') < $m) $birth = $birth-1;
elseif (date('n') == $m and date('j') < $d) $birth = $birth-1;
if (($d >= 20) and ($m == 03)) {
$znak = 'Овен';
}
elseif (($d <= 20) and ($m == 04)) {
$znak = 'Овен';
}
if (($d >= 20) and ($m == 04)) {
$znak = 'Телец';
}
elseif (($d <= 21) and ($m == 05)) {
$znak = 'Телец';
}
if (($d >= 21) and ($m == 05)) {
$znak = 'Близнецы';
}
elseif (($d <= 21) and ($m == 06)) {
$znak = 'Близнецы';
}
if (($d >= 21) and ($m == 06)) {
$znak = 'Рак';
}
elseif (($d <= 22) and ($m == 07)) {
$znak = 'Рак';
}
if (($d >= 22) and ($m == 07)) {
$znak = 'Лев';
}
elseif (($d <= 22) and ($m == 08)) {
$znak = 'Лев';
}
if (($d >= 23) and ($m == 08)) {
$znak = 'Дева';
}
elseif (($d <= 20) and ($m == 09)) {
$znak = 'Дева';
}
if (($d >= 23) and ($m == 09)) {
$znak = 'Весы';
}
elseif (($d <= 23) and ($m == 10)) {
$znak = 'Весы';
}
if (($d >= 24) and ($m == 10)) {
$znak = 'Скорпион';
}
elseif (($d <= 22) and ($m == 11)) {
$znak = 'Скорпион';
}
if (($d >= 23) and ($m == 11)) {
$znak = 'Стрелец';
}
elseif (($d <= 21) and ($m == 12)) {
$znak = 'Стрелец';
}
if (($d >= 22) and ($m == 12)) {
$znak = 'Козерог';
}
elseif (($d <= 20) and ($m == 01)) {
$znak = 'Козерог';
}
if (($d >= 21) and ($m == 01)) {
$znak = 'Водолей';
}
elseif (($d <= 18) and ($m == 02)) {
$znak = 'Водолей';
}
if (($d >= 19) and ($m == 02)) {
$znak = 'Рыбы';
}
elseif (($d <= 20) and ($m == 03)) {
$znak = 'Рыбы';
}
return $znak;
}
}
//-------------функции онлайна юзера-------------//
function online_user($ius)
{
if (isset($ius)) $ius = intval($ius);
$result = mysql_query("SELECT `id`, `onl` FROM `users` WHERE `id` = '$ius' LIMIT 1");
$nik = mysql_fetch_assoc($result);
if (!empty($nik['id']) && $nik['onl'] + 200 > time()) {
return $ius;
}
}
//-------------функции рейтинга юзера-------------//
function rat($var)
{
$rat = mysql_fetch_assoc(mysql_query("SELECT `rating`, `ank_rating` FROM `users` WHERE `id` = '" . my_int($var) . "' LIMIT 1"));
$rats = $rat['rating'] + $rat['ank_rating'];
return $rats;
}
//-------------функция фильтра букв-------------//
function my_check($var)
{
$var = trim($var);
$var = str_replace(" 0", '', $var);
$var = mysql_real_escape_string($var);
$var = htmlspecialchars($var, ENT_QUOTES, 'UTF-8');
$var = str_replace("%", "%", $var);
$var = str_replace("_", "_", $var);
$var = iconv('utf-8', 'windows-1251', $var);
$var = iconv('windows-1251', 'utf-8', $var);
return $var;
}
//------------функция фильтра цифр-------------//
function my_int($var)
{
$var = abs((int)$var);
return $var;
}
//-------------Функция вывода быстрых смайлов-------------//
function quicksmiles()
{
$sm = mysql_query("SELECT * FROM `smiles` ORDER BY RAND() DESC LIMIT 5");
while($i = mysql_fetch_assoc($sm)) {
echo '<a href="#form" onclick="javascript:tag(' '.$i['name'].' ', '');"><img src="../'.$i['path'].'" alt="image" /></a> ';
}
}
//-------------Вспомогательная функция быстрой вставки-------------//
function quickpaste($form) {
echo '<script language="JavaScript" type="text/javascript">
function tag(text1, text2) {
if ((document.selection)) {
document.form.' . $form . '.focus();
document.form.document.selection.createRange().text = text1+document.form.document.selection.createRange().text+text2;
} else if(document.forms['form'].elements['' . $form . ''].selectionStart!=undefined) {
var element = document.forms['form'].elements['' . $form . ''];
var str = element.value;
var start = element.selectionStart;
var length = element.selectionEnd - element.selectionStart;
element.value = str.substr(0, start) + text1 + str.substr(start, length) + text2 + str.substr(start + length);
} else document.form.' . $form . '.value += text1+text2;
}
</script>';
}
//-------------функция смайлов-------------//
function smiles($str) {
$querysmiles = mysql_query("SELECT `name`, `path` FROM `smiles`");
while($arrsmiles = mysql_fetch_assoc($querysmiles))
{
$str = str_replace($arrsmiles['name'], '<img src="/' . $arrsmiles['path'] . '" alt="'.$arrsmiles['name'].'"/>', $str);
}
return $str;
}
//-------------функция возраста-------------//
function calc_age($data)
{
$ex_age = explode('.', $data);
$age = date('Y') - $ex_age[2];
if (date('m') < $ex_age[1] || (date('m') == $ex_age[1] && date('d') < $ex_age[0])) {
$age--;
}
$age = (int)$age;
/*
$q1 = abs($age) % 100;
$q2 = $age % 10;
if ($q1 > 10 && $q1 < 20) {
$result = 'лет';
} elseif ($q2 > 1 && $q2 < 5) {
$result = 'года';
} elseif ($q2 == 1) {
$result = 'год';
} else {
$result = 'лет';
}
*/
if ($age == date('Y')) $age = 0;
return $age;
}
//-------------функция игнора-------------//
function ignor($f1 = NULL, $f2 = NULL, $w = NULL)
{
if (isset($f1)) $f1 = check($f1);
if (isset($f2)) $f2 = check($f2);
if (isset($w)) $w = check($w);
$f = mysql_fetch_assoc(mysql_query("SELECT * FROM `ignor` WHERE `user_id` = '$f1' AND `ig_id` = '$f2'"));
if ($w == NULL) {
if ($f1 != $f2) {
if (isset($f['id'])) return 1;
else return 0;
} else {
return 0;
}
} else {
if (isset($f['id'])) return $f[$w];
}
}
//-------------функция инфы о юзере-------------//
function user_inf($ref = NULL, $w = NULL)
{
if (isset($ref)) $ref = check($ref);
if (!ctype_digit($ref)) {
$latuser = mb_strtolower($ref, 'UTF8');
$result = mysql_query("SELECT * FROM `users` WHERE `latuser` = '$latuser' LIMIT 1");
} else {
$result = mysql_query("SELECT * FROM `users` WHERE `id` = '$ref' LIMIT 1");
}
$nik = mysql_fetch_array($result);
if ($w == NULL) return $nik['id'];
else return $nik[$w];
}
//-------------функция записи онлайна-------------//
function whorm($rm = 0, $room = NULL)
{
global $user, $ipl, $agent, $ontime, $onsite;
if (!empty($_SESSION['us'])) {
$agent = mysql_real_escape_string(check($agent));
// вычитание рейтинга за непосещаемость
$visitEx = explode('/', $user['visit']);
if ($visitEx[0] < date('d') && $user['rating'] > 0) {
$numVisit = date('d') - $visitEx[0];
if ($numVisit >= 3) {
mysql_query("UPDATE users SET rating = '" . minus($user['rating'], (5 * $numVisit)) . "' WHERE id = '$user[id]' LIMIT 1");
}
}
mysql_query("UPDATE `users` SET
`onl` = '" . time() . "',
`visit` = '" . date('d/m/y H:i') . "',
`user_ip` = '$ipl',
`user_soft` = '$agent',
`room` = '$room'
WHERE `id` = '$user[id]' LIMIT 1");
// запись времени онлайна
$ontime = $user['on_time'];
if ($user['onl'] > (time() - 200)) {
$onsite = $ontime + time() - $user['onl'];
mysql_query("UPDATE `users` SET `on_time` = '$onsite' WHERE `id` = '$user[id]' LIMIT 1");
}
}
}
//-------------функция временного бана-------------//
function kikt($t)
{
$t2 = $t - time();
if ($t2 > (60 * 60 * 24 * 30)) $t3 = round($t2 / (60 * 60 * 24 * 30)) . ' месяцев';
elseif ($t2 > (60 * 60 * 24)) $t3 = round($t2 / (60 * 60 * 24)) . ' дней';
elseif ($t2 > (60 * 60)) $t3 = round($t2 / (60 * 60)) . ' часов';
elseif ($t2 > 60) $t3 = round($t2 / 60) . ' минут';
else $t3 = $t2 . ' секунд';
return $t3;
}
//-------------функция вывода сообщений-------------//
function msg($msg)
{
echo '<div class="msg_notice">' . $msg . '</div>';
}
function err($msg)
{
echo '<div class="msg_error">' . $msg . '</div>';
}
//-------------функция транслита-------------//
function rus_to_k($str)
{
$str = str_replace("а","a",$str);
$str = str_replace("б","b",$str);
$str = str_replace("в","v",$str);
$str = str_replace("г","g",$str);
$str = str_replace("д","d",$str);
$str = str_replace("е","e",$str);
$str = str_replace("ё","e",$str);
$str = str_replace("ж","j",$str);
$str = str_replace("з","z",$str);
$str = str_replace("и","i",$str);
$str = str_replace("й","y",$str);
$str = str_replace("к","k",$str);
$str = str_replace("л","l",$str);
$str = str_replace("м","m",$str);
$str = str_replace("н","n",$str);
$str = str_replace("о","o",$str);
$str = str_replace("п","p",$str);
$str = str_replace("р","r",$str);
$str = str_replace("с","s",$str);
$str = str_replace("т","t",$str);
$str = str_replace("у","u",$str);
$str = str_replace("ф","f",$str);
$str = str_replace("х","h",$str);
$str = str_replace("ч","c",$str);
$str = str_replace("ц","q",$str);
$str = str_replace("ш","w",$str);
$str = str_replace("щ",">",$str);
$str = str_replace("ь","<",$str);
$str = str_replace("ы","x",$str);
$str = str_replace("ъ",".",$str);
$str = str_replace("э",":",$str);
$str = str_replace("ю",";",$str);
$str = str_replace("я","}",$str);
$str = str_replace("А","a",$str);
$str = str_replace("Б","b",$str);
$str = str_replace("В","v",$str);
$str = str_replace("Г","g",$str);
$str = str_replace("Д","d",$str);
$str = str_replace("Е","e",$str);
$str = str_replace("Ё","e",$str);
$str = str_replace("Ж","j",$str);
$str = str_replace("З","z",$str);
$str = str_replace("И","i",$str);
$str = str_replace("Й","y",$str);
$str = str_replace("К","k",$str);
$str = str_replace("Л","l",$str);
$str = str_replace("М","m",$str);
$str = str_replace("Н","n",$str);
$str = str_replace("О","o",$str);
$str = str_replace("П","p",$str);
$str = str_replace("Р","r",$str);
$str = str_replace("С","s",$str);
$str = str_replace("Т","t",$str);
$str = str_replace("У","u",$str);
$str = str_replace("Ф","f",$str);
$str = str_replace("Х","h",$str);
$str = str_replace("Ч","c",$str);
$str = str_replace("Ц","q",$str);
$str = str_replace("Ш","w",$str);
$str = str_replace("Щ",">",$str);
$str = str_replace("Ь","<",$str);
$str = str_replace("Ы","x",$str);
$str = str_replace("Ъ",".",$str);
$str = str_replace("Э",":",$str);
$str = str_replace("Ю",";",$str);
$str = str_replace("Я","}",$str);
return $str;
}
//-------------функция перекодировки из вин в утф-------------//
function win_to_utf($str)
{
if (function_exists('mb_convert_encoding')) return mb_convert_encoding($str, 'utf-8', 'windows-1251');
if (function_exists('iconv')) return iconv('windows-1251', 'utf-8', $str);
$win1251utf8 = array(
"xC0"=>"А","xC1"=>"Б","xC2"=>"В","xC3"=>"Г","xC4"=>"Д","xC5"=>"Е","xA8"=>"Ё","xC6"=>"Ж","xC7"=>"З","xC8"=>"И","xC9"=>"Й","xCA"=>"К","xCB"=>"Л","xCC"=>"М",
"xCD"=>"Н","xCE"=>"О","xCF"=>"П","xD0"=>"Р","xD1"=>"С","xD2"=>"Т","xD3"=>"У","xD4"=>"Ф","xD5"=>"Х","xD6"=>"Ц","xD7"=>"Ч","xD8"=>"Ш","xD9"=>"Щ","xDA"=>"Ъ",
"xDB"=>"Ы","xDC"=>"Ь","xDD"=>"Э","xDE"=>"Ю","xDF"=>"Я","xE0"=>"а","xE1"=>"б","xE2"=>"в","xE3"=>"г","xE4"=>"д","xE5"=>"е","xB8"=>"ё","xE6"=>"ж","xE7"=>"з",
"xE8"=>"и","xE9"=>"й","xEA"=>"к","xEB"=>"л","xEC"=>"м","xED"=>"н","xEE"=>"о","xEF"=>"п","xF0"=>"р","xF1"=>"с","xF2"=>"т","xF3"=>"у","xF4"=>"ф","xF5"=>"х",
"xF6"=>"ц","xF7"=>"ч","xF8"=>"ш","xF9"=>"щ","xFA"=>"ъ","xFB"=>"ы","xFC"=>"ь","xFD"=>"э","xFE"=>"ю","xFF"=>"я");
return strtr($str, $win1251utf8);
}
//-------------функция перекодировки из утф в вин-------------//
function utf_to_win($str)
{
if (function_exists('mb_convert_encoding')) return mb_convert_encoding($str, 'windows-1251', 'utf-8');
if (function_exists('iconv')) return iconv('utf-8', 'windows-1251', $str);
$utf8win1251 = array(
"А"=>"xC0","Б"=>"xC1","В"=>"xC2","Г"=>"xC3","Д"=>"xC4","Е"=>"xC5","Ё"=>"xA8","Ж"=>"xC6","З"=>"xC7","И"=>"xC8","Й"=>"xC9","К"=>"xCA","Л"=>"xCB","М"=>"xCC",
"Н"=>"xCD","О"=>"xCE","П"=>"xCF","Р"=>"xD0","С"=>"xD1","Т"=>"xD2","У"=>"xD3","Ф"=>"xD4","Х"=>"xD5","Ц"=>"xD6","Ч"=>"xD7","Ш"=>"xD8","Щ"=>"xD9","Ъ"=>"xDA",
"Ы"=>"xDB","Ь"=>"xDC","Э"=>"xDD","Ю"=>"xDE","Я"=>"xDF","а"=>"xE0","б"=>"xE1","в"=>"xE2","г"=>"xE3","д"=>"xE4","е"=>"xE5","ё"=>"xB8","ж"=>"xE6","з"=>"xE7",
"и"=>"xE8","й"=>"xE9","к"=>"xEA","л"=>"xEB","м"=>"xEC","н"=>"xED","о"=>"xEE","п"=>"xEF","р"=>"xF0","с"=>"xF1","т"=>"xF2","у"=>"xF3","ф"=>"xF4","х"=>"xF5",
"ц"=>"xF6","ч"=>"xF7","ш"=>"xF8","щ"=>"xF9","ъ"=>"xFA","ы"=>"xFB","ь"=>"xFC","э"=>"xFD","ю"=>"xFE","я"=>"xFF");
return strtr($str, $utf8win1251);
}
//-------------функция транслита-------------//
function trun_to_rus($str)
{
$translate = array
(
'YO' => 'Ё', 'Yo' => 'Ё', 'yo' => 'ё', 'ZH' => 'Ж',
'Zh' => 'Ж', 'zh' => 'ж', 'CH' => 'Ч', 'Ch' => 'Ч',
'ch' => 'ч', 'SH' => 'Ш', 'Sh' => 'Ш', 'sh' => 'ш',
'SHC' => 'Щ', 'Shc' => 'Щ', 'shc' => 'щ', 'QQ' => 'Ъ',
'qq' => 'ъ', 'YE' => 'Э', 'Ye' => 'Э', 'ye' => 'э',
'YU' => 'Ю', 'Yu' => 'Ю', 'yu' => 'ю', 'YA' => 'Я',
'Ya' => 'Я', 'ya' => 'я', 'YI' => 'Ы', 'Yi' => 'Ы',
'yi' => 'ы', 'A' => 'А', 'a' => 'а', 'B' => 'Б',
'b' => 'б', 'C' => 'Ц', 'c' => 'ц', 'D' => 'Д',
'd' => 'д', 'E' => 'Е', 'e' => 'е', 'F' => 'Ф',
'f' => 'ф', 'G' => 'Г', 'g' => 'г', 'H' => 'Х',
'h' => 'х', 'X' => 'Х', 'x' => 'х', 'I' => 'И',
'i' => 'и', 'K' => 'К', 'k' => 'к', 'L' => 'Л',
'l' => 'л', 'M' => 'М', 'm' => 'м', 'N' => 'Н',
'n' => 'н', 'O' => 'О', 'o' => 'о', 'P' => 'П',
'p' => 'п', 'Q' => 'Ь', 'q' => 'ь', 'R' => 'Р',
'r' => 'р', 'S' => 'С', 's' => 'с', 'T' => 'Т',
't' => 'т', 'U' => 'У', 'u' => 'у', 'V' => 'В',
'v' => 'в', 'W' => 'Ш', 'w' => 'ш', 'J' => 'Й',
'j' => 'й', 'Z' => 'З', 'z' => 'з'
);
preg_match_all('/#([^[]+)#/U', $str, $a);
$str = strtr($str, $translate);
preg_match_all('/#([^[]+)#/U', $str, $b);
$str = str_replace(array_values($b[0]), array_values($a[1]), $str);
return $str;
}
//-------------функция ретранлсита-------------//
function retranslit($in)
{
$trans1 = array("'",'`',',',' ',"Ё","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы");
$trans2 = array('_','_','_','_',"JO","ZH","CH","SH","SCH","Je","Jy","Ja","jo","zh","ch","sh","sch","je","jy","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","","y");
return str_replace($trans1, $trans2, $in);
}
//-------------функция экранирования и замены спецсимволов-------------//
function check($message)
{
$message = nl2br(htmlspecialchars($message, ENT_QUOTES, 'UTF-8'));
$message = strtr($message, array(
chr(0)=> '',
chr(1)=> '',
chr(2)=> '',
chr(3)=> '',
chr(4)=> '',
chr(5)=> '',
chr(6)=> '',
chr(7)=> '',
chr(8)=> '',
chr(9)=> '',
chr(10)=> '',
chr(11)=> '',
chr(12)=> '',
chr(13)=> '',
chr(14)=> '',
chr(15)=> '',
chr(16)=> '',
chr(17)=> '',
chr(18)=> '',
chr(19)=> '',
chr(20)=> '',
chr(21)=> '',
chr(22)=> '',
chr(23)=> '',
chr(24)=> '',
chr(25)=> '',
chr(26)=> '',
chr(27)=> '',
chr(28)=> '',
chr(29)=> '',
chr(30)=> '',
chr(31)=> ''
));
$message = str_replace("'", "'", $message);
$message = str_replace('\', "\", $message);
$message = str_replace("|", "I", $message);
$message = str_replace("||", "I", $message);
$message = str_replace("/\$/", "$", $message);
$message = stripslashes($message);
$message = iconv('utf-8', 'windows-1251', $message);
$message = iconv('windows-1251', 'utf-8', $message);
return $message;
}
//-------------функция замены рус букв-------------//
function replace_rus($str)
{
$str = str_replace("а","|",$str);
$str = str_replace("б","|",$str);
$str = str_replace("в","|",$str);
$str = str_replace("г","|",$str);
$str = str_replace("д","|",$str);
$str = str_replace("е","|",$str);
$str = str_replace("ё","|",$str);
$str = str_replace("ж","|",$str);
$str = str_replace("з","|",$str);
$str = str_replace("и","|",$str);
$str = str_replace("й","|",$str);
$str = str_replace("к","|",$str);
$str = str_replace("л","|",$str);
$str = str_replace("м","|",$str);
$str = str_replace("н","|",$str);
$str = str_replace("о","|",$str);
$str = str_replace("п","|",$str);
$str = str_replace("р","|",$str);
$str = str_replace("с","|",$str);
$str = str_replace("т","|",$str);
$str = str_replace("у","|",$str);
$str = str_replace("ф","|",$str);
$str = str_replace("х","|",$str);
$str = str_replace("ч","|",$str);
$str = str_replace("ц","|",$str);
$str = str_replace("ш","|",$str);
$str = str_replace("щ","|",$str);
$str = str_replace("ь","|",$str);
$str = str_replace("ы","|",$str);
$str = str_replace("ъ","|",$str);
$str = str_replace("э","|",$str);
$str = str_replace("ю","|",$str);
$str = str_replace("я","|",$str);
$str = str_replace("А","|",$str);
$str = str_replace("Б","|",$str);
$str = str_replace("В","|",$str);
$str = str_replace("Г","|",$str);
$str = str_replace("Д","|",$str);
$str = str_replace("Е","|",$str);
$str = str_replace("Ё","|",$str);
$str = str_replace("Ж","|",$str);
$str = str_replace("З","|",$str);
$str = str_replace("?","|",$str);
$str = str_replace("Й","|",$str);
$str = str_replace("К","|",$str);
$str = str_replace("Л","|",$str);
$str = str_replace("М","|",$str);
$str = str_replace("Н","|",$str);
$str = str_replace("О","|",$str);
$str = str_replace("П","|",$str);
$str = str_replace("Р","|",$str);
$str = str_replace("С","|",$str);
$str = str_replace("Т","|",$str);
$str = str_replace("У","|",$str);
$str = str_replace("Ф","|",$str);
$str = str_replace("Х","|",$str);
$str = str_replace("Ч","|",$str);
$str = str_replace("Ц","|",$str);
$str = str_replace("Ш","|",$str);
$str = str_replace("Щ","|",$str);
$str = str_replace("Ь","|",$str);
$str = str_replace("Ы","|",$str);
$str = str_replace("Ъ","|",$str);
$str = str_replace("Э","|",$str);
$str = str_replace("Ю","|",$str);
$str = str_replace("Я","|",$str);
return $str;
}
//-------------Сжатие начало-------------//
if (extension_loaded('zlib') and ini_get('zlib.output_compression') != 1 and ini_get('output_handler') != 'ob_gzhandler')
{
$PREFER_DEFLATE = false;
$FORCE_COMPRESSION = false;
function compress_output_gzip($output)
{
return gzencode($output);
}
function compress_output_deflate($output)
{
return gzdeflate($output, 9);
}
function compress_output_x_gzip($output)
{
return gzcompress($output, 9);
}
if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
$AE = $_SERVER['HTTP_ACCEPT_ENCODING'];
else
$AE = $_SERVER['HTTP_TE'];
$support_gzip = (strpos($AE, 'gzip') !== FALSE) || $FORCE_COMPRESSION;
$support_deflate = (strpos($AE, 'deflate') !== FALSE) || $FORCE_COMPRESSION;
$support_x_gzip = (strpos($AE, 'x-gzip') !== FALSE) || $FORCE_COMPRESSION;
if ($support_gzip && $support_deflate)
{
$support_deflate = $PREFER_DEFLATE;
}
if ($support_deflate)
{
header("Content-Encoding: deflate");
ob_start("compress_output_deflate");
}
else
{
if ($support_gzip)
{
header("Content-Encoding: gzip");
ob_start("compress_output_gzip");
}
else
{
if ($support_x_gzip)
{
header("Content-Encoding: x_gzip");
ob_start("compress_output_x_gzip");
}
else
{
ob_start();
$config_gzip = 0;
}
}
}
}
else
{
$config_gzip = 0;
}
// Сжатие конец
// Дивы
$div_navi = '<div class="navi">';
$div_title = '<div class="title">';
$div_razdel = '<div class="razdel">';
$div_tworazdel = '<div class="tworazdel">';
$div_aut = '<div class="aut">';
$div_line = '<div class="line">';
$div_footer = '<div class="footer">';
$div_menu = '<div class="menu">';
$div_menu_i = '<div class="menu_icon">';
$div_pager = '<div class="pager">';
$div_left = '<div style="text-align: left; margin: 2px;">';
$div_right = '<div style="text-align: right; margin: 2px;">';
$div_center = '<div style="text-align: center; margin: 2px;">';
$div_end = '</div>';
?>