View file sistem/functions.dat

File size: 2.97Kb
<?php
function new_count_post()
{
   //увеличиваем счетчик постов в форуме на 1 
   $nomer_post = file_get_contents("../data/forum/count_post.dat") + 1;
   $file_count_post = fopen("../data/forum/count_post.dat", "w+");
   flock ($file_count_post,LOCK_EX);
   fputs($file_count_post,$nomer_post);
   flock ($file_count_post,LOCK_UN);
   fclose($file_count_post);
   @chmod("../data/forum/count_post.dat", 0666);
   return $nomer_post;
}



function new_count_temes()
{
   //увеличиваем счетчик тем в форуме на 1
   $nomer_temes = file_get_contents("../data/forum/count_temes.dat") + 1;
   $file_count_temes = fopen("../data/forum/count_temes.dat", "w+");
   flock ($file_count_temes,LOCK_EX);
   fputs($file_count_temes,$nomer_temes);
   flock ($file_count_temes,LOCK_UN);
   fclose($file_count_temes);
   @chmod("../data/forum/count_temes.dat", 0666);
   return $nomer_temes;
}



function new_count_razd()
{
   //увеличиваем счетчик разделов в форуме на 1
   $nomer_razd = file_get_contents("../data/forum/count_razd.dat") + 1;
   $file_count_razd = fopen("../data/forum/count_razd.dat", "w+");
   flock ($file_count_razd,LOCK_EX);
   fputs($file_count_razd,$nomer_razd);
   flock ($file_count_razd,LOCK_UN);
   fclose($file_count_razd);
   @chmod("../data/forum/count_razd.dat", 0666);
   return $nomer_razd;
}



function off_smiles($txtsob)
{ 
//стандартные смайлы
$txtsob =str_replace("<img src='../img/1.gif' alt=''>",":)",$txtsob);
$txtsob =str_replace("<img src='../img/1.gif' alt=''>",":-)",$txtsob);
$txtsob =str_replace("<img src='../img/2.gif' alt=''>",":(",$txtsob);
$txtsob =str_replace("<img src='../img/2.gif' alt=''>",":-(",$txtsob);

//остальные
$txtsob =str_replace("<img src='../img/",":",$txtsob);
$txtsob =str_replace(".gif' alt=''>",":",$txtsob);

//bb
$txtsob = preg_replace('#<big>(.*?)</big>#si', '[big]\1[/big]', $txtsob);
$txtsob = preg_replace('#<b>(.*?)</b>#si', '[b]\1[/b]', $txtsob);
$txtsob = preg_replace('#<i>(.*?)</i>#si', '[i]\1[/i]', $txtsob);
$txtsob = preg_replace('#<u>(.*?)</u>#si', '[u]\1[/u]', $txtsob);
$txtsob = preg_replace('#<small>(.*?)</small>#si', '[small]\1[/small]', $txtsob);

$txtsob = preg_replace('#<font color="\#FF0000">(.*?)</font>#si', '[red]\1[/red]', $txtsob);
$txtsob = preg_replace('#<font color="\#00FF00">(.*?)</font>#si', '[green]\1[/green]', $txtsob);
$txtsob = preg_replace('#<font color="\#0000FF">(.*?)</font>#si', '[blue]\1[/blue]', $txtsob);
$txtsob = preg_replace('#<font color="\#FFFF00">(.*?)</font>#si', '[yellow]\1[/yellow]', $txtsob);

$txtsob = preg_replace('#<div class="ramk">(.*?)</div>#si', '[q]\1[/q]', $txtsob);
$txtsob = preg_replace('#<del>(.*?)</del>#si', '[del]\1[/del]', $txtsob);

$txtsob =str_replace('<a href="','[url=',$txtsob);
$txtsob =str_replace('">',']',$txtsob);
$txtsob =str_replace('</a>','[/url]',$txtsob);

return $txtsob;
}
?>