Просмотр файла forum/includes/functions.php

Размер файла: 6.57Kb
<?php
##################################
#           functions.php        #
##################################
#   Форум на MySQL               #
#Афтар : Morgan                  #
#ICQ : 530-648                   #
#Email : [email protected]           #
##################################

////////////////////////////- Функция для показа смайлов -////////////////////////////
  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 bb_code($text)
{
$text = preg_replace('| http\:\/\/(.+) |i','<a href="http://$1">http://$1</a>',$text);
$text = preg_replace('|\[b](.+)\[\/b]|','<b>$1</b>',$text);
$text = preg_replace('|\[i](.+)\[\/i]|','<i>$1</i>',$text);
$text = preg_replace('|\[u](.+)\[\/u]|','<u>$1</u>',$text);
$text = preg_replace('|\[big](.+)\[\/big]|','<big>$1</big>',$text);
$text = preg_replace('|\[small](.+)\[\/small]|','<small>$1</small>',$text);
$text = preg_replace('|\[del](.+)\[\/del]|','<del>$1</del>',$text);

$text = str_replace(array('[b]','[i]','[u]','[big]','[small]','[del]','[/b]','[/i]','[/u]','[/big]','[/small]','[/del]'),'',$text);
return $text;
}
////////////////////////////- Функция для обработки переменных -////////////////////////////
  function obr($var,$type)
{
if($type == 'string')
 {
 $var = htmlspecialchars(trim($var));
 }
 elseif($type == 'integer')
 {
 $var = abs(intval($var));
 }
return $var;
}
////////////////////////////- Функция для показа юзеров Online -////////////////////////////
  function online($user_id)
{

if(mysql_num_rows(mysql_query('SELECT id FROM `online` WHERE `id_user`='.$user_id.' LIMIT 1'))!=0)
  {

$is_online = '<font color="#00f000">[On]</font>';

  }
  else
  {
$is_online = '<font color="#f00000">[Off]</font>';
  }
return $is_online;
}
////////////////////////////- Функция антимата -////////////////////////////
  function antimat($text)
{

#$text = iconv('UTF-8','KOI8-U',$text);
$text = str_ireplace(array('лох','гей'),'*****',$text);
#$text = iconv('KOI8-U','UTF-8',$text);
return $text;
}
////////////////////////////- Функция показа ника с цветом -////////////////////////////
  function illuminate($user_id)
{

$user_id_inf = mysql_fetch_array(mysql_query('SELECT login,dol FROM `users` WHERE `id`='.$user_id.' LIMIT 1'));

 if(mysql_num_rows(mysql_query('SELECT id FROM `ban_users` WHERE `id_user`='.$user_id.' LIMIT 1'))!=0)
 {

$pok ='<font color="#000000">'.$user_id_inf['login'].'</font>';

 }
 else
{
 if($user_id_inf['dol']=='admin')
 {
$pok ='<font color="#0033FF">'.$user_id_inf['login'].'</font>';
 }
 elseif($user_id_inf['dol']=='moderator')
 {
$pok ='<font color="#077212">'.$user_id_inf['login'].'</font>';
 }
 elseif($user_id_inf['dol']=='user')
 {
$pok =$user_id_inf['login'];
 }

}
return $pok;
}
////////////////////////////- Функция  -////////////////////////////
////////////////////////////- Функция  -////////////////////////////
////////////////////////////- Функция  -////////////////////////////



##################################
#      © Все права защищены      #
##################################
?>