Просмотр файла function.php

Размер файла: 5.03Kb
<?php
////////////////////////////- Функция для показа смайлов -////////////////////////////
function smiles($text)
{
$text = str_replace(')p','<img src="images/smiles/)P.gif"/>',$text);
$text = str_replace('=)','<img src="images/smiles/=).gif"/>',$text);
$text = str_replace('=]','<img src="images/smiles/=].gif"/>',$text);
$text = str_replace('[admin]','<img src="images/smiles/admin.gif"/>',$text);
$text = str_replace('[answer]','<img src="images/smiles/answer.gif"/>',$text);
$text = str_replace('[close]','<img src="images/smiles/close.gif"/>',$text);
$text = str_replace('[dollar]','<img src="images/smiles/dollar.gif"/>',$text);
$text = str_replace('[dumay]','<img src="images/smiles/dumay.gif"/>',$text);
$text = str_replace('[elvis]','<img src="images/smiles/elvis.gif"/>',$text);
$text = str_replace('[flowers]','<img src="images/smiles/flowers.gif"/>',$text);
$text = str_replace('[hachu]','<img src="images/smiles/hachu.gif"/>',$text);
$text = str_replace('[in_love]','<img src="images/smiles/in_love.gif"/>',$text);
$text = str_replace('[kaleka]','<img src="images/smiles/kaleka.gif"/>',$text);
$text = str_replace('[man]','<img src="images/smiles/man.gif"/>',$text);
$text = str_replace('[mod]','<img src="images/smiles/mod.gif"/>',$text);
$text = str_replace('[molodec]','<img src="images/smiles/molodec.gif"/>',$text);
$text = str_replace('[monah]','<img src="images/smiles/monah.gif"/>',$text);
$text = str_replace('[moroz]','<img src="images/smiles/moroz.gif"/>',$text);
$text = str_replace('[neznay]','<img src="images/smiles/neznay.gif"/>',$text);
$text = str_replace('[ninzya]','<img src="images/smiles/ninzya.gif"/>',$text);
$text = str_replace('[O_o2]','<img src="images/smiles/O_o2.gif"/>',$text);
$text = str_replace('[O_o]','<img src="images/smiles/O_o.gif"/>',$text);
$text = str_replace('[ofigel]','<img src="images/smiles/ofigel.gif"/>',$text);
$text = str_replace('[ok]','<img src="images/smiles/ok.gif"/>',$text);
$text = str_replace('[OoO]','<img src="images/smiles/OoO.gif"/>',$text);
$text = str_replace('[open]','<img src="images/smiles/open.gif"/>',$text);
$text = str_replace('[pank]','<img src="images/smiles/pank.gif"/>',$text);
$text = str_replace('[plachu]','<img src="images/smiles/plachu.gif"/>',$text);
$text = str_replace('[podmig]','<img src="images/smiles/podmig.gif"/>',$text);
$text = str_replace('[simp]','<img src="images/smiles/simp.gif"/>',$text);
$text = str_replace('[sleza]','<img src="images/smiles/sleza.gif"/>',$text);
$text = str_replace('[smele2]','<img src="images/smiles/smele2.gif"/>',$text);
$text = str_replace('[smile1]','<img src="images/smiles/smile1.gif"/>',$text);
$text = str_replace('[smile3]','<img src="images/smiles/smile3.gif"/>',$text);
$text = str_replace('[smile4]','<img src="images/smiles/smile4.gif"/>',$text);
$text = str_replace('[smile]','<img src="images/smiles/smile.gif"/>',$text);
$text = str_replace('[somnevays]','<img src="images/smiles/somnevays.gif"/>',$text);
$text = str_replace('[soska]','<img src="images/smiles/soska.gif"/>',$text);
$text = str_replace('[ura]','<img src="images/smiles/ura.gif"/>',$text);
$text = str_replace('[uuu]','<img src="images/smiles/uuu.gif"/>',$text);
$text = str_replace('[xuy]','<img src="images/smiles/xuy.gif"/>',$text);
$text = str_replace('[yxaxa]','<img src="images/smiles/yxaxa.gif"/>',$text);
$text = str_replace('[zloy]','<img src="images/smiles/zloy.gif"/>', $text);
return $text;
}
////////////////////////////- Функция для работы с BBcode -////////////////////////////
function code($text)
{
$text=htmlspecialchars($text);
$text=stripslashes($text);
$text=str_replace("\r\n","<br> ",$text);
$text=str_replace("\n",'<br/> ',$text);
$text = preg_replace('#\[big\](.*?)\[/big\]#si', '<big>\1</big>', $text);
$text = preg_replace('#\[b\](.*?)\[/b\]#si', '<b>\1</b>', $text);
$text = preg_replace('#\[i\](.*?)\[/i\]#si', '<i>\1</i>', $text);
$text = preg_replace('#\[u\](.*?)\[/u\]#si', '<u>\1</u>', $text);
$text = preg_replace('#\[small\](.*?)\[/small\]#si', '<small>\1</small>', $text);
$text = preg_replace('#\[color:(.*?)\](.*?)\[/color\]#si', '<font color="\1">\2</font>', $text);
$text = preg_replace('#\[url=(.*?)\](.*?)\[/url\]#si', '<a href="\1">\2</a>', $text);
$text = mysql_real_escape_string(trim($text));
return $text;
}
////////////////////////////- Функция для защиты -////////////////////////////
function antihack () 
{   
$uri = $_SERVER['REQUEST_URI'];  
$arr_u = explode("?", $uri );
$url = $arr_u[0];  
$p_url = $arr_u[1];  
$inj='/script|http|<|>|<|>|SELECT|UNION|UPDATE|DELETE|OR|shell_exec|htaccess|FROM WHERE include require php|passthru|AND|exe|exec|INSERT|tmp/i';  
if (preg_match($inj, $p_url )) {    
die("Hacking attempt!"); 
}  
}
////////////////////////////- Функция антимата -////////////////////////////
function antimat($text)
{
$text = str_ireplace(array('лох','гей','пидор','пизда','хуй','еблан','уебок','заебал','долбоеб','хуисос'),'[*****]',$text);
return $text;
}
?>