Файл: CMS/themes/stywap/index.php
Строк: 415
<?php
if (!defined('CMS')) { die('Access Denied!'); }
/* Настройки темы */
define('ICONS','/themes/stywap/icons/');
$_SESSION['kcaptcha']['background_color'] = array( mt_rand( 200, 255 ), mt_rand( 200, 255 ), mt_rand( 200, 255 ) );
$_SESSION['kcaptcha']['foreground_color'] = array( mt_rand( 0, 100 ), mt_rand( 0, 100 ), mt_rand( 0, 100 ) );
$_SESSION[SP]['color'] = array( mt_rand( 50, 200 ), mt_rand( 50, 200 ), mt_rand( 50, 200 ) );
$themes['navigation'] = '<div class="navigation">{PAGES}</div>';
$themes['border_color'] = '#891516';
if (empty($themes['menu'])) {
$themes['menu'] = '';
if ($is_logged) {
if (!empty($uset['users_newprivat'])) {
$priv = ' <span class="blink">+' . num($uset['users_newprivat']) . '</span>';
if (!empty($config['sound_privat'])) $priv .= sound_privat();
}
else $priv = '';
$ipol = ($uset['users_gender'] == 1) ? 'qlt_man_b.png' : 'qlt_woman_b.png';
$themes['menu'] .= '
<div id="navi">
<table style="width:100%" cellspacing="0" cellpadding="0"><tr>
<td style="vertical-align:top;width:19%;">
<a class="top_menu_link" href="' . gen_users($log, 'start', '', RND) . '" title="Старт">
<!-- img class="icon" src="/images/icons/qlt_home_b.png" alt="Старт"/ -->Старт
</a>
</td>
<td style="vertical-align:top;width:19%;">
<a class="top_menu_link" href="' . gen_users($log, 'index', '', RND) . '" title="Я">
<!-- img class="icon" src="/images/icons/' . $ipol . '" alt="Я"/ -->Я
</a>
</td>
<td style="vertical-align:top;width:20%;">
<a class="top_menu_link" href="' . gen_users($log, 'privat', '', RND) . '" title="Почта">
<!-- img class="icon" src="/images/icons/qlt_mail_b.png" alt="Почта"/ -->Почта
' . $priv . '</a>
</td>
<td style="vertical-align:top;width:19%;">
<a class="top_menu_link" href="' . gen_users($log, 'lenta', '', RND) . '" title="Лента">
<!-- img class="icon" src="/images/icons/qlt_journal_b.png" alt="Лента"/ -->Лента
</a>
</td>
<td style="vertical-align:top;width:21%">
<a class="top_menu_link" href="' . $config['site_url'] . DS . gen_uri('exit') . '" title="Выход">
<!-- img class="icon" src="/images/icons/qlt_off_b.png" alt="Выход" / -->Выход
</a>
</td>
</tr></table></div>';
if (is_admin(array(101,102,103,105))) {
$themes['menu'] .= '<div class="box"><div><a href="' . gen_admin() . '">Админ-панель</a></div></div>';
}
}
else {
$themes['menu'] .= '<div id="navi"><table style="width:100%" cellspacing="0" cellpadding="0"><tr>';
$themes['menu'] .= '<td style="vertical-align:middle;width:19%;border-right:solid; border-width:1px">';
$themes['menu'] .= '<a href="' . $config['site_url'] . DS . gen_uri('login', '', RND) . '">Вход</a></td>';
$themes['menu'] .= '<td style="vertical-align:top;width:19%;border-width:1px;">';
$themes['menu'] .= '<a href="' . $config['site_url'] . DS . gen_uri('reg', '', RND) . '">Регистрация</a></td>';
$themes['menu'] .= '</tr></table></div>';
}
}
/* Функции темы */
function blink($text = '', $color = '#FF0000') {
return '<span style="text-decoration: blink; color: ' . $color . ';">' . $text . '</span>';
}
function icon($icon_name, $icon_dir = '', $title = '', $check = '', $type = 0) {
global $config;
if ($config['enable_icons'] < 1) return;
$return = '';
if (!empty($icon_dir)) {
$relative_path = IMAGES . $icon_dir . '/' . $icon_name;
}
else $relative_path = ICONS . $icon_name;
if ($check != '') {
if (file_exists($relative_path) != TRUE) {
return;
}
}
$return .= '<img src="' . $relative_path . '"';
if ($title != '') {
$return .= ' title="' . $title . '" alt="' . $title . '" /> ';
}
else $return .= ' alt="" /> ';
if ($type == 1) {
$return = $relative_path;
}
return $return;
}
function show_error($error, $return = false) {
$show = '<div class="b">';
$show .= icon('error.gif', 'icons') . ' <b>' . $error . '</b><br /></div>';
if (!$return) echo $show;
else return $show;
}
function show_link($uri, $name, $other = '') {
$other = !empty($other) ? $other : '';
$show = '<div class="b">';
$show .= '- <a href="' . $uri . '" title="' . $name . '">' . $name . '</a>' . $other . '<br />';
$show .= '</div>';
return $show;
}
function show_login($notice, $return = false) {
global $config;
$show = '<div class="message_warning">' . $notice . '<br />';
$show .= '<a href="' . $config['site_url'] . DS . gen_uri('login', '', RND) . '"><b>Авторизоваться</b></a> или в начале ';
$show .= '<a href="' . $config['site_url'] . DS . gen_uri('reg', '', RND) . '"><b>Зарегистрироваться</b></a></div>';
if (!$return) echo $show;
else return $show;
}
function show_bookmarks_form($title = '') {
global $is_logged, $config, $log;
if (!$is_logged) return show_login('<span id="bookmarks">Вы не авторизованы</span>, чтобы добавлять свои закладки, необходимо', 1);
$parse = parse_url($_SERVER['REQUEST_URI']);
$form = new cmsForm(gen_users($log, 'bookmarks', '', 'rnd=' . $_SESSION['token']), 'post', ' id="bookmarks"');
$form->addCode('<b>Добавить в Закладки: ' . $title . '</b><br />');
$form->addRadio('Закладка видна:', 'type', request('type',0),array('0' => 'Всем', '1' => 'Только мне'));
$form->addTextarea('Заметка (max 250):', 'note', request('note'));
$form->addHidden('uri', $parse['path']);
$form->addHidden('title', $title);
return $form->Submit('Добавить', 'submit', 'btns', '', 1);
}
function show_bookmarks($title = '', $url = '', $cnt = '') {
if (!empty($_REQUEST['add_bookmarks'])) {
return show_bookmarks_form($title);
}
else {
$url = !empty($url) ? $url : '?add_bookmarks=1';
$str = '<div class="b">';
$str .= '<img src="/images/icons/star--arrow.png" alt="" /> ';
$str .= '<a href="' . $url . '#bookmarks">В закладки</a> (' . num($cnt) . ')<br /></div>';
return $str;
}
}
function show_header($title = '', $keywords = '', $description = '', $header = 'Y') {
global $db, $config, $themes, $is_logged, $uset, $brow;
header('Content-type:text/html; charset=utf-8');
$config['title'] = !empty($title) ? StripMeta($title) : $config['site_title'];
$config['keywords'] = !empty($keywords) ? genKeywords($keywords) : $config['site_keys'];
$config['description'] = !empty($description) ? genDescription($description) : $config['site_desc'];
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru" dir="ltr">
<head>
<title>' . $config['title'] . '</title>
<meta name="google-site-verification" content="1vu9NeJeO1qfhQA_VlacQ95pznmUJ6ig0Rlt2ufYfDo" />
<meta name="keywords" content="' . $config['keywords'] . '" />
<meta name="description" content="' . $config['description'] . '" />
<meta name="robots" content="index, follow" />
<meta name="revisit-after" content="3 days" />
<style type="text/css">
' . file_get_contents(dirname(__FILE__) . '/style.css') . '
</style>
</head>
<body><div class="head">';
$ex = explode('.', $config['site_name']);
echo '<div class="logo"><a href="' . $config['site_url'] . '">
<img src="' . THEMES_DIR . '/images/llogo.png" align="left" alt="" />
<span class="grey">' . $ex[0] . '</span> <span class="red">.' . $ex[1] . '</span></a></div>
</div>';
if (!empty($themes['lider']) && !defined('IS_INDEX') && !defined('IS_START')) {
echo '<div class="c">' .icon('crown.png', 'icons') . users_anketa($themes['lider']) . '</div>';
}
echo $themes['menu'] . '<div id="up"></div>';
if (!empty($_SESSION['core_message'][0][0]) && !empty($_SESSION['core_message'][0][1])) {
$message = cmsSession::getInstance()->getMessages();
echo '<div class="message_' . $message[0][0] . '">' . $message[0][1] . '</div>';
}
/*
if (!empty($header) && $header != 'N') {
switch($header):
case 'C':
echo '<div class="d" id="up">' . $config['title'] . '<br /></div>';
echo '<div class="c">';
break;
case 'L':
echo '<div class="d" id="up">' . $config['title'] . '<br /></div>';
echo '<div class="b">';
break;
case 'Y':
echo '<div class="d" id="up">' . $config['title'] . '<br /></div>';
break;
default:
echo '<div class="d" id="up">' . $header . '<br /></div>';
break;
endswitch;
}
*/
}
function show_footer() {
global $db, $config, $uset, $ip, $brow;
global $support_gzip, $support_deflate, $support_x_gzip;
$uset['site_url'] = !empty($uset['site_url']) ? check($uset['site_url']) : $config['site_url'];
$uset['site_name'] = !empty($uset['site_name']) ? check($uset['site_name']) : $config['site_name'];
if (!defined('IS_INDEX')) {
if ($config['show_ads'] == 1 && !defined('EMPTY_ADS')) {
$ads = $db->select("SELECT * FROM ?_ads WHERE (`ads_time` - UNIX_TIMESTAMP()) > 0 ORDER BY rand() LIMIT 0," . $config['ads_num']);
if (!empty($ads)) {
echo '<div class="box">';
foreach( $ads as $ad ) {
if(!empty($ad['ads_color'])) $ad['ads_name'] = '<span style="color:' . $ad['ads_color'] . ';">' . $ad['ads_name'] . '</span>';
if(!empty($ad['ads_bold'])) $ad['ads_name'] = '<b>' . $ad['ads_name'] . '</b>';
echo '<div> <a href="/' . gen_uri('ads', $ad['ads_id'], RND) . '">' . $ad['ads_name'] . '</a></div>';
}
echo '</div>';
}
}
//echo '<div class="b">';
//echo '<span id="down"> ' . icon('home.png') . ' <a href="' . $config['site_url'] . '">На главную</a></span>';
//echo '</div>';
}
/* Gen Time Pages */
if (!empty($config['allow_gen_time'])) {
global $mts;
//echo round(microtime(1) - $mts, 4) . ' сек.<br />';
}
/* Gzip Pages */
if ($support_gzip || $support_deflate || $support_x_gzip) {
$Contents = ob_get_contents();
$gzip_file = strlen($Contents);
if (isset($support_deflate)):
$gzip_file_out = strlen(gzdeflate($Contents, 9));
else:
if (isset($support_gzip)):
$gzip_file_out = strlen(gzencode($Contents, 9));
else:
if (isset($support_x_gzip)):
$gzip_file_out = strlen(gzcompress($Contents, 9));
else:
$gzip_file_out = strlen($Contents);
endif;
endif;
endif;
$gzip_pro = round(100 - (100 / ($gzip_file / $gzip_file_out)), 1);
if ($gzip_pro > 0 && $gzip_pro < 100) {
if (!empty($config['allow_gzip'])) {
//echo 'Cжатие: ' . $gzip_pro . '%<br />';
}
}
}
else {
$gzip_file = ob_get_length();
$gzip_file_out = $gzip_file;
}
/* Установка сессионных переменных */
if (empty($_SESSION['traffic'])) {
$_SESSION['traffic'] = 0;
}
if (empty($_SESSION['traffic2'])) {
$_SESSION['traffic2'] = 0;
}
$_SESSION['traffic'] = $_SESSION['traffic'] + $gzip_file_out;
$_SESSION['traffic2'] = $_SESSION['traffic2'] + $gzip_file;
$_SESSION['counton']++;
require_once( MODULES_PATH . 'online.inc.php' );
if (!defined('IS_INDEX')) {
echo '<div class="foot" style="min-height: 30px;">';
echo '<span id="down"> ' . icon('home.png') . ' <a href="' . $config['site_url'] . '">На главную</a></span><br />';
require_once( THEMES_PATH . 'counter.php' );
}
else {
echo '<div class="foot" style="min-height: 40px;">';
if (!empty($config['allow_online'])) {
$on = $db->selectRow("SELECT COUNT(`online_id`) AS `users`,
(SELECT COUNT(`online_id`) FROM ?_users_online WHERE `online_user` = '') AS `guest`
FROM ?_users_online WHERE `online_user` != '';");
$on = array_map('intval', $on);
echo '<a href="' . $config['site_url'] . '/' . gen_uri('online', '', RND) . '">Онлайн: ' . $on['users'] . DS . $on['guest'] . '</a><br />';
}
else {
echo '<a href="' . $config['site_url'] . '">© ' . $uset['site_name'] . ' ' . date('Y') . '</a>';
}
require_once( THEMES_PATH . 'counter_index.php' );
}
echo '</div></body></html>';
//$out = ob_get_clean();
//echo $out;
die;
}
# Функция вывода рейтинга
function format_num($num = 0) {
if ($num > 0) {
return '<span style="color:#00aa00">+' . $num . '</span>';
}
else if ($num < 0) {
return '<span style="color:#ff0000">' . $num . '</span>';
}
else {
return 0;
}
}
# Функция вывода mp3 плеера
function mp3_player($file = '') {
return <<<HTML
<script type="text/javascript" src="/images/audio-player.js"></script>
<script type="text/javascript">AudioPlayer.setup("/images/player.swf", {width:"300",animation:"yes",encode:"no",initialvolume:"60",loop:"yes",remaining:"yes",noinfo:"yes",buffer:"5",checkpolicy:"yes",rtl:"no",bg:"1C6182",text:"FFFFFF",leftbg:"04356a",lefticon:"FFFFFF",volslider:"000000",voltrack:"FFFFFF",rightbg:"04356a",rightbghover:"000000",righticon:"f3f2ed",righticonhover:"f3f2ed",track:"9CACC0",loader:"000000",border:"CCCCCC",tracker:"000000",skip:"000000",pagebg:"9CACC0",transparentpagebg:"yes"});</script>
<!-- p class="audioplayer_container" -->
<div class="b"><span id="audioplayer_1">У вас не включен Flash Player, включите его или установите версии не ниже 9</span></div>
<script type="text/javascript">AudioPlayer.embed("audioplayer_1", {soundFile:"{$file}"});</script>
HTML;
}
# Функция вывода видео плеера
function video_player($file = '') {
return <<<HTML
<script type="text/javascript" src="/images/swfobject.js"></script>
<div class="c" align="center" id="player1">
<a href="http://www.macromedia.com/go/getflashplayer">Установите Flash Player</a> для просмотра видео.
</div>
<script type="text/javascript">
var s1 = new SWFObject("/images/flvplayer.swf","single","520","380","7");
s1.addParam("allowfullscreen","true");
s1.addVariable("file","{$file}");
s1.addVariable("autostart","true");
s1.addVariable("image","/images/playflvimg.jpg");
s1.addVariable("width","520");
s1.addVariable("height","380");
s1.write("player1");
</script>
HTML;
}
?>