<?php
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 trun_to_rus($str)
{
$str=str_replace('ch','ч',$str);
$str=str_replace('sc','щ',$str);
$str=str_replace('ye','э',$str);
$str=str_replace('yu','ю',$str);
$str=str_replace('ya','я',$str);
$str=str_replace('CH','Ч',$str);
$str=str_replace('SC','Щ',$str);
$str=str_replace('""','Ъ',$str);
$str=str_replace('"','ъ',$str);
$str=str_replace("''",'Ь',$str);
$str=str_replace("'",'ь',$str);
$str=str_replace('YE','Э',$str);
$str=str_replace('YU','Ю',$str);
$str=str_replace('YA','Я',$str);
return strtr($str,array("'"=>'','"'=>'','a'=>'а','b'=>'б','v'=>'в','g'=>'г','d'=>'д','e'=>'е','j'=>'ж','z'=>'з','i'=>'и','y'=>'й','k'=>'к','l'=>'л','m'=>'м','n'=>'н','o'=>'о','p'=>'п','r'=>'р','s'=>'с','t'=>'т','u'=>'у','f'=>'ф','h'=>'х','c'=>'ц','w'=>'ш','x'=>'ы','A'=>'А','B'=>'Б','V'=>'В','G'=>'Г','D'=>'Д','E'=>'Е','J'=>'Ж','Z'=>'З','I'=>'и','Y'=>'Й','K'=>'К','L'=>'Л','M'=>'М','N'=>'Н','O'=>'О','P'=>'П','R'=>'Р','S'=>'С','T'=>'Т','U'=>'У','F'=>'Ф','H'=>'Х','C'=>'Ц','W'=>'Ш','X'=>'Ы'));
}
function check($str)
{
$str = str_replace("\\n", ' ', $str);
$str = str_replace("\n", ' ', $str);
$str = strtr($str,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)=>'',chr(127)=>''));
$str = mysql_escape_string(trim(rawurldecode(htmlspecialchars($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;
}
function msg_check($str)
{
$str = str_replace("\\n", ' ', $str);
$str = str_replace("\n", ' ', $str);
$str = strtr($str,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)=>'',chr(127)=>''));
$str = mysql_escape_string(trim(rawurldecode($str)));
require 'bbcode/bbcode.lib.php';
$smiles = array(
':sing:' => '<img src="bbcode/smilies/33.gif" alt="sing"/>',
':sex:' => '<img src="bbcode/smilies/46.gif" alt="sex"/>',
':horns:' => '<img src="bbcode/smilies/47.gif" alt="horns"/>',
':hoo:' => '<img src="bbcode/smilies/72.gif" alt="hoo"/>',
':haaw:' => '<img src="bbcode/smilies/77.gif" alt="haaw"/>'
);
$bb = new bbcode($str);
$bb -> mnemonics = $smiles;
$str = $bb -> get_html();
$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;
}
function go($pg,$all,$text)
{
global $_SERVER;
$page1 = $pg - 2;
$page2 = $pg - 1;
$page3 = $pg + 1;
$page4 = $pg + 2;
if($page1 > 0)
{$go.= '<a href="'.$_SERVER['PHP_SELF'].'?pg='.$page1.$text.'">'.$page1.'</a> ';}
if($page2 > 0)
{$go.= '<a href="'.$_SERVER['PHP_SELF'].'?pg='.$page2.$text.'">'.$page2.'</a> ';}
$go.= $pg.' ';
if($page3 <= $all)
{$go.= '<a href="'.$_SERVER['PHP_SELF'].'?pg='.$page3.$text.'">'.$page3.'</a> ';}
if($page4 <= $all)
{$go.= '<a href="'.$_SERVER['PHP_SELF'].'?pg='.$page4.$text.'">'.$page4.'</a> ';}
if($all > 3 && $all > $page4)
{$go.= '... <a href="'.$_SERVER['PHP_SELF'].'?pg='.$all.$text.'">'.$all.'</a>';}
if($page1 > 1)
{$go = '<a href="'.$_SERVER['PHP_SELF'].'?pg=1'.$text.'">1</a> ... '.$go;}
if($go == $pg.' ')
{return;}
else
{return $go.'<br/>';}
}
?>