Просмотр файла inc/fnc.php

Размер файла: 6.67Kb
<?
///////////////////////////
///by Kyber 2011
///Поддержка klybok.net
///ICQ 626-000-895
///Не для продажы!!!
///Потрачено 23 часа 
///Реквизиты для помощи: 
///R 191559143752
///Z 109983295073
///U 211922671748 
///Изменять код скрипта ЗАПРЕЩЕНО!!!
///Нарушители получат блок хостинга
///////////////////////////
list($msec, $sec) = explode(chr(32), microtime());
$headtime = $sec + $msec;
ini_set('error_reporting', true);
ini_set('display_errors',true);
ini_set('register_globals', false);
ini_set('session.use_cookies', true);
ini_set('session.use_trans_sid', false);
ini_set('arg_separator.output', "&amp;");
ini_set('arg_separator.input', "&amp;");
ini_set('magic_quotes_gpc', false);
ini_set('mbstring.internal_encoding', 'UTF-8');
ob_start();
session_name('SID'); session_start();

$folder_level ='';
$count=substr_count($_SERVER['SCRIPT_NAME'], '/');
	for ($i=1;$i<$count;$i++){
	$folder_level .= "../";}
define("H", $folder_level);

function head ($title) {
global $SET;
header('Content-type: application/xhtml+xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ua">
<head>
<title>'.$SET['site_name'].' | '.$title.'</title>
<link rel="shortcut icon" href="'.H.'favicon.ico" />
<link rel="stylesheet" href="'.H.'inc/style.css" type="text/css" />
</head><body>';
}

function foot () {
global $headtime, $time;
list($msec, $sec) = explode(chr(32), microtime());
$tgen=round(($sec + $msec) - $headtime, 3);
$k =  mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `sess` <> '' AND `time` > '".($time-600)."'"),0);
$kg =  mysql_result(mysql_query("SELECT COUNT(*) FROM `g`"),0);
echo '<div class="foot">
<a href="'.H.'online.php">Покупателей в магазине: '.$k.'</a><br />
<a href="'.H.'online.php?guest">Гостей в магазине: '.$kg.'</a><br />';
if ( $_SERVER['SCRIPT_NAME'] == '/index.php' ) R(2); else R(4);
echo '<center>© by Kyber <a href="http://klybok.net">[ klybok.net ]</a></center>';
echo '<center>';
echo '<a href="http://caused.ru/in_350"><img src="http://caused.ru/img-small_350" alt="Caused.Ru"/></a> <a href="http://topn1.ru/click.php?3054"><img src="http://topn1.ru/image.php?3054,small" alt="topn1.ru" /></a> <a href="http://oxax.net/click.php?2"><img src="http://oxax.net/image.php?2,small" alt="oxax.net" /></a>';
echo '</center>';
echo '<center>';
echo '<a href="http://mstop.ru/?uid=6025"><img src="http://mstop.ru/count.php?6025" alt="mstop.ru"/></a> <a href="http://wapstat.info/?uid=752"><img src="http://wapstat.info/c.php?uid=752" alt="wapstat.info"/></a> <a href="http://imtop.ru/11269/in/"><img src="http://imtop.ru/11269/small.png" alt="imTop.ru" /></a>';
echo '</center>';
echo '</div></body></html>';
exit;
}

function BBcode($t) {
$t = preg_replace('#\[b\](.*)\[/b\]#i','<b>\1</b>', $t);
$t = preg_replace('#\[i\](.*)\[/i\]#i','<i>\1</i>', $t);
$t = preg_replace('#\[u\](.*)\[/u\]#i','<u>\1</u>', $t);
$t = preg_replace('#\[big\](.*)\[/big\]#i','<big>\1</big>', $t);
$t = preg_replace('#\[small\](.*)\[/small\]#i','<small>\1</small>', $t);
$t = preg_replace('#\[red\](.*)\[/red\]#i','<span style="color:red;">\1</span>', $t);
$t = preg_replace('#\[black\](.*)\[/black\]#i','<span style="color:black;">\1</span>', $t);
$t = preg_replace('#\[green\](.*)\[/green\]#i','<span style="color:green;">\1</span>', $t);
$t = preg_replace('#\[blink\](.*)\[/blink\]#i','<blink>\1</blink>', $t);
$t = eregi_replace("((https?|ftp)://[[:alnum:]_=/-]+(\\.[[:alnum:]_=/-]+)*(/[[:alnum:]+&amp;._=/~%#]*(\\?[[:alnum:]?+&amp;_=/%#]*)?)?)", "<a href=\"\\1\" target=\"_blank\">\\1</a>", $t);
$t = preg_replace("#\[url=<a href=\"(.*?)\" target=\"_blank\">\\1</a>\](.*?)\[/url\]#si", "<a href=\"\\1\">\\2</a>",  $t);
//$t = preg_replace('#http://(.*)#i', '<a target="_blank" href="http://\1">\1</a>', $t);
//$t = preg_replace('#\[url=http://(.*)\](.*)\[/url\]#i', '<a target="_blank" href="http://\1">\2</a>', $t);
return $t;
}
  
function smiles($t) {
$S = file('inc/smiles/s.txt');
	foreach($S as $k => $v) {
	$p = explode('|', $v); 
	$p1 = explode(' ', $p[1]);
		foreach ($p1 as $k1 => $v1) {
		$t = str_replace(trim($v1), '<img src="inc/smiles/'.$p[0].'" alt="'.$v1.'" />', $t);	
		}
	}
return $t;
}
   
function in ($t) {
return  trim(htmlentities($t, ENT_QUOTES, 'UTF-8' ));
}

function out ($t,$smiles=false, $bbcode=false) {
$t = nl2br($t);
	if ($bbcode == true) $t = BBcode($t); 
	if ($smiles == true) $t = smiles($t);
return $t;
}

function data ($t) {
$t = date ("j/n/y  H:i", $t);
$t=str_replace("Jan","Янв",$t);
$c=str_replace("Feb","Фев",$c);
$c=str_replace("Mar","Март",$c);
$c=str_replace("May","Мая",$c);
$c=str_replace("Apr","Апр",$c);
$c=str_replace("Jun","Июня",$c);
$c=str_replace("Jul","Июля",$c);
$c=str_replace("Aug","Авг",$c);
$c=str_replace("Sep","Сент",$c);
$c=str_replace("Oct","Окт",$c);
$c=str_replace("Nov","Нояб",$c);
$c=str_replace("Dec","Дек",$c);
return $t;
}

function P() {
global $U;
	if (isset($U)) {
	$k = mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `u2` = '$U[id]' AND `read` = '0'"), 0);
		if ($k > 0) return '<a href="'.H.'mail.php?act=in"><span class="err">Вам Письмо! ('.$k.')</span></a><br />';
	}
}

function page() {
global $k_page;
	if (isset($_GET['page'])) {
	if ($_GET['page'] == 'end') $page = $k_page;
	else $page = abs(intval($_GET['page']));
	} 
	else $page = 1;
	if ($page > $k_page) $page = $k_page;
return $page;
}

function str($link, $k_page, $page) {
echo '<div class="cont">';
if ($page != 1 ) echo '<a href="'.$link.'page='.($page-1).'">&lt;-Пред</a>';
if ($page != 1 AND $page != $k_page ) echo '|';
if ($page != $k_page) echo '<a href="'.$link.'page='.($page+1).'">Cлед-&gt;</a>';
echo '<br />';
if ($page != 1) echo '<a href="'.$link.'page=1">1</a>'; else echo '1';
for ($ot=-3; $ot<=3; $ot++) {
	if ($page + $ot > 1 AND $page + $ot < $k_page) {
		if ($ot==-3 AND $ot + $page > 2) echo ',..';
		if ($ot != 0) echo ',<a href="'.$link.'page='.($page+$ot).'">'.($page+$ot).'</a>'; else echo ','.($page+$ot);
		if ($ot==3 AND $ot + $page < $k_page-1) echo ',..';
	}
}
if ($page != $k_page) echo ',<a href="'.$link.'page='.$k_page.'">'.$k_page.'</a>'; else echo ','.$k_page;
echo '</div>';
}

function R($t) {
$q = mysql_query("SELECT * FROM `rekl` WHERE `place` = $t ORDER BY `pos` ASC ");
	if (mysql_num_rows($q) > 0) {
		while ($r = mysql_fetch_assoc($q)) echo stripcslashes($r['link']).'<br />';		
	}	
}
?>