<?php
////////////////Подключение модулей/////////////////
function modules(){
$mod = $_GET['mod'];
switch($mod){
case 'in':
case 'kom_sites':
case 'out':
case 'stat':
case 'top':
case 'mpanel':
case 'registration':
case 'news':
case 'bans':
break;
default:
$mod = 'main';
break;
}
include ROOTPATH."/lib/".$mod.".php";
}
/////////////Статус Новостей///////////////
function news_status($status){
switch($status){
case '1':
return "<b>Новость</b>:";
break;
case '2':
return "<b>Акция</b>:";
break;
case '3':
return "<b>Внимание!</b>:";
break;
default:
return "<b>Новость</b>:";
break;
}
}
///////////Вывод последней новости на главную стр./////////////
function main_news(){
$sql = mysql_query("SELECT * FROM `cat_news` ORDER by `id` DESC LIMIT 0,1");
$result = "";
$news = "";
if(mysql_num_rows($sql) > 0){
while($row = mysql_fetch_assoc($sql)){
if($row['date'] == date("d.m.Y")){
$date = "[Сегодня]";
}else{
$date = "[".$row['date']."]";
}
echo "<div class='title'>".news_status($row['status'])."<u>".$row['title']."</u> ".$date."</div>";
echo mb_substr($row['news'],0,60, "UTF-8")."...<br/><div class='niz_a'><a href='/news/".$row['id']."'>Подробние...</a><b>|</b><a href='/news/'>Все новости</a></div>";
}
}else{
echo "Новостей нет";
}
}
////////////Реклама//////////////////
function rekla($op){
if ($op =='head'){
$sql = mysql_query("SELECT * FROM `cat_rekla` WHERE `fh` = '1' ORDER BY `position` DESC");
if(mysql_num_rows($sql) > 0){
while($rekla = mysql_fetch_assoc($sql)){
$ret .= $rekla['code'];
}
}else{
$ret = "Рекламное место сдаётся!<br/>";
}
}else{
$sql = mysql_query("SELECT * FROM `cat_rekla` WHERE `fh` = '0' ORDER BY `position`;");
if(mysql_num_rows($sql) > 0){
while($rekla = mysql_fetch_assoc($sql)){
$ret .= $rekla['code'];
}
}else{
$ret = "Рекламное место сдаётся!<br/>";
}
}
echo $ret;
}
//////////////////Новый сайт//////////////
function rand_site(){
$sql = mysql_query("SELECT * FROM `cat_users` ORDER by `id` DESC LIMIT 0,1");
$row = mysql_fetch_assoc($sql);
echo "<div class='title'>Новый сайт</div>";
echo "<div class='menu'>";
echo "<img src='style/images/go.gif' alt='' /><a href='/out/".$row['id']."'>".$row['name']."</a> <a href='/stat/".$row['id']."'>[?]</a><br/>";
echo "»<span class='menu_s'>".$row['about']."</span><br/>";
echo "</div>";
}
//////////////////////////Детект пхоне!1//////////////////////////
function detect_mobile_device(){
if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce')){
return false;
}
if(eregi('up.browser|up.link|windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp',$_SERVER['HTTP_USER_AGENT'])){
return true;
}
if(stristr($_SERVER['HTTP_ACCEPT'],'text/vnd.wap.wml')||stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml')){
return true;
}
if(isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])||isset($_SERVER['X-OperaMini-Features'])||isset($_SERVER['UA-pixels'])){
return true;
}
$a = array(
'acs-'=>'acs-',
'alav'=>'alav',
'alca'=>'alca',
'amoi'=>'amoi',
'audi'=>'audi',
'aste'=>'aste',
'avan'=>'avan',
'benq'=>'benq',
'bird'=>'bird',
'blac'=>'blac',
'blaz'=>'blaz',
'brew'=>'brew',
'cell'=>'cell',
'cldc'=>'cldc',
'cmd-'=>'cmd-',
'dang'=>'dang',
'doco'=>'doco',
'eric'=>'eric',
'hipt'=>'hipt',
'inno'=>'inno',
'ipaq'=>'ipaq',
'java'=>'java',
'jigs'=>'jigs',
'kddi'=>'kddi',
'keji'=>'keji',
'leno'=>'leno',
'lg-c'=>'lg-c',
'lg-d'=>'lg-d',
'lg-g'=>'lg-g',
'lge-'=>'lge-',
'maui'=>'maui',
'maxo'=>'maxo',
'midp'=>'midp',
'mits'=>'mits',
'mmef'=>'mmef',
'mobi'=>'mobi',
'mot-'=>'mot-',
'moto'=>'moto',
'mwbp'=>'mwbp',
'nec-'=>'nec-',
'newt'=>'newt',
'noki'=>'noki',
'opwv'=>'opwv',
'palm'=>'palm',
'pana'=>'pana',
'pant'=>'pant',
'pdxg'=>'pdxg',
'phil'=>'phil',
'play'=>'play',
'pluc'=>'pluc',
'port'=>'port',
'prox'=>'prox',
'qtek'=>'qtek',
'qwap'=>'qwap',
'sage'=>'sage',
'sams'=>'sams',
'sany'=>'sany',
'sch-'=>'sch-',
'sec-'=>'sec-',
'send'=>'send',
'seri'=>'seri',
'sgh-'=>'sgh-',
'shar'=>'shar',
'sie-'=>'sie-',
'siem'=>'siem',
'smal'=>'smal',
'smar'=>'smar',
'sony'=>'sony',
'sph-'=>'sph-',
'symb'=>'symb',
't-mo'=>'t-mo',
'teli'=>'teli',
'tim-'=>'tim-',
'tosh'=>'tosh',
'treo'=>'treo',
'tsm-'=>'tsm-',
'upg1'=>'upg1',
'upsi'=>'upsi',
'vk-v'=>'vk-v',
'voda'=>'voda',
'wap-'=>'wap-',
'wapa'=>'wapa',
'wapi'=>'wapi',
'wapp'=>'wapp',
'wapr'=>'wapr',
'webc'=>'webc',
'winw'=>'winw',
'winw'=>'winw',
'xda-'=>'xda-'
);
if(isset($a[substr($_SERVER['HTTP_USER_AGENT'],0,4)])){
return true;
}
}
function detect_iphone(){
if(eregi('iphone',$_SERVER['HTTP_USER_AGENT'])||eregi('ipod',$_SERVER['HTTP_USER_AGENT'])){
return true;
}
}
/////////////////Настроки/////////////////////////
function sys_cat(){
$system = mysql_query("SELECT * FROM `cat_system`");
$sys = mysql_fetch_assoc($system);
define ( 'sys_moderacia', $sys[moderacia] );
define ( 'sys_komnews', $sys[komnews] );
define ( 'sys_komsites', $sys[komsites] );
define ( 'sys_rega', $sys[rega] );
if(sys_moderacia == "1"){
define ( 'status', 'mod' );
}else{
define ( 'status', 'off' );
}
}
/**********************/
/*Нарушение авторских прав, приследуется темной за углом*/
/*(с) govnokod by DeeP */
?>