/*Функция сколько раз */
function rest ($number, $titles = array(/*1*/'раз', /*2*/'раза', /*5*/'раз')) {
$cases = array (2, 0, 1, 1, 1, 2);
return $number.' '.$titles[($number % 100 > 4 && $number % 100 < 20) ? 2 : $cases[min($number % 10, 5)]];
}
function status($id){
global $set;
$p = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='$id' LIMIT 1"));
$a = mysql_fetch_array(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user`='$id' AND `avatar`='1' LIMIT 1"));
if (is_file(H."sys/gallery/50/$a[id].$a[ras]"))
echo "
";
elseif ($id == 0)
echo "
";
else
echo "
";
}
?>
function resize($file_input, $file_output, $w_o, $h_o, $percent = false) {
list($w_i, $h_i, $type) = getimagesize($file_input);
if (!$w_i || !$h_i) {
echo 'Невозможно получить длину и ширину изображения';
return;
}
$types = array('','gif','jpeg','png');
$ext = $types[$type];
if ($ext) { $func = 'imagecreatefrom'.$ext;
$img = $func($file_input); } else { echo 'Некорректный формат файла';
return; }
if ($percent) { $w_o *= $w_i / 100;
$h_o *= $h_i / 100;
} if (!$h_o) $h_o = $w_o/($w_i/$h_i);
if (!$w_o) $w_o = $h_o/($h_i/$w_i); $img_o = imagecreatetruecolor($w_o, $h_o);
imagecopyresampled($img_o, $img, 0, 0, 0, 0, $w_o, $h_o, $w_i, $h_i);
if ($type == 2) {
return imagejpeg($img_o,$file_output,100);
} else { $func = 'image'.$ext;
return $func($img_o,$file_output); }
}
function crop($file_input, $file_output, $crop = 'square',$percent = false) {
list($w_i, $h_i, $type) = getimagesize($file_input);
if (!$w_i || !$h_i) {
echo 'Невозможно получить длину и ширину изображения';
return;
}
$types = array('','gif','jpeg','png');
$ext = $types[$type];
if ($ext) {
$func = 'imagecreatefrom'.$ext;
$img = $func($file_input);
} else {
echo 'Некорректный формат файла';
return;
}
if ($crop == 'square') {
$min = $w_i;
if ($w_i > $h_i) $min = $h_i;
$w_o = $h_o = $min;
} else {
list($x_o, $y_o, $w_o, $h_o) = $crop; if ($percent) {
$w_o *= $w_i / 100;
$h_o *= $h_i / 100;
$x_o *= $w_i / 100;
$y_o *= $h_i / 100;
}
if ($w_o < 0) $w_o += $w_i;
$w_o -= $x_o;
if ($h_o < 0) $h_o += $h_i;
$h_o -= $y_o;
}
$img_o = imagecreatetruecolor($w_o, $h_o);
imagecopy($img_o, $img, 0, 0, $x_o, $y_o, $w_o, $h_o);
if ($type == 2) {
return imagejpeg($img_o,$file_output,100);
} else {
$func = 'image'.$ext;
return $func($img_o,$file_output);
}
}
?>
mysql_query("UPDATE `user` SET `date_last` = ".time()." WHERE `us_online` = '1'");
?>
#Функция на монеты
function money_namber ($number2, $titles2 = array(/*1*/'монета', /*2*/'монеты', /*5*/'монет'))
{
$cases2 = array (2, 0, 1, 1, 1, 2);
return $titles2[($number2 % 100 > 4 && $number2 % 100 < 20) ? 2 : $cases2[min($number2 % 10, 5)]];
}
?>
/*Функция сколько очков */
function och ($number, $titles = array(/*1*/'очко', /*2*/'очка', /*5*/'очков'))
{
$cases = array (2, 0, 1, 1, 1, 2);
return $number.' '.$titles[($number % 100 > 4 && $number % 100 < 20) ? 2 : $cases[min($number % 10, 5)]];
}
?>
function output_text($str,$us=null,$br=1,$html=1, $smiles=1,$links=1,$bbcode=1) {
global $user, $theme_ini,$ank,$ank2,$post;
$vyvod=mysql_query("SELECT * FROM `spam` WHERE `act`='1'");
while ($anti = mysql_fetch_assoc($vyvod)) {
$a = 'http://'.$anti['eto'].'';
$test=stristr($str,$a);
$test2 = stristr($str,$anti['eto']);
$vol= str_replace(' ','',$str);
$test3 = stristr($vol,$anti['eto']);
$vol1= str_replace('
','',$str);
$test4 = stristr($vol1,$anti['eto']);
if($test==TRUE && $_SERVER['QUERY_STRING']!='id=0' && $test != $_SERVER['HTTP_HOST'] || $test2==TRUE && $_SERVER['QUERY_STRING']!='id=0' && $test2 != $_SERVER['HTTP_HOST'] || $test3==TRUE || $test4==TRUE){
$str=str_replace($test,$test2,$anti['na'],$str);
}
}
$str = html_entity_decode($str, ENT_QUOTES, 'UTF-8');
if ($html)$str=htmlentities($str, ENT_QUOTES, 'UTF-8'); // преобразуем все к нормальному перевариванию браузером
if ($links)$str=links($str); // обработка ссылок
if ($smiles)$str=smiles($str); // добавление смайлов
if ($bbcode)
{
$tmp_str=$str;
$str=bbcode($str); // обработка бб-кодов
}
if ($br){
$str=br($str); // перенос строк
}
if ($us==null) {
if(!empty($ank2['id'])){
$us = $ank2['id'];
}else if(!empty($post['id_user'])){
$us =$post['id_user'];
}else if(!empty($ank['id'])){
$us = $ank['id'];
}
}
$userse = get_user($us);
$str =''.(!empty($userse['color_text']) && $userse['color_text']!=NULL && $userse['color_time']>=time() ?''.$str.'':$str).'';
return (stripslashes(stripslashes($str))); // возвращаем обработанную строку
}
function input_value_text($str){return output_text($str,0,1,0,0,0);}
function rez_text( $text, $maxwords = 15, $maxchar = 60){
$sep=' ';
$sep2=' »';
$words = explode($sep,$text);
$char = iconv_strlen($text,'utf-8');
if (count($words) > $maxwords){$text = join($sep, array_slice($words, 0, $maxwords));}
if ( $char > $maxchar ){
$text = iconv_substr( $text, 0, $maxchar, 'utf-8' );
}
return $text.$sep2;
}
?>
/*
* Вывод авторитета как в Mobimeet
*/
function star($L = 0)
{
// Задаем параметр
$R = array('8' => '5', '7' => '25', '6' => '125', '5' => '375', '4' => '1875', '3' => '9375', '2' => '46875', '1' => '234375', '0' => '1171876');
$IMAGE = NULL;
$L = (int) $L;
// Рекурсивное вычисление
if ($R['0'] > $L)
{
for ($k = 0; 9 > $k; $k++)
{
if ($L >= $R[$k] && $L <= $R[$k - 1])
{
$III = $L / $R[$k];
for($S = 0; $S < intval($III); $S++)
{
$IMAGE .= '
';
$L = $L - $R[$k];
}
}
}
}
else
{
for ($k = 1; 5 >= $k; $k++)
{
$IMAGE .= '
';
}
}
return $IMAGE;
}
?>
if (!function_exists('copyright'))
{
function copyright($fiera)
{
return preg_replace("#1(\n|\r)*1