Файл: themes/default/index.php
Строк: 274
<?php
if (!defined('CMS')) { die('Access Denied!'); }
define('ICONS','/themes/default/icons/');
$_SESSION[SP]['color'] = array(122,174,0); // График голосований
/**
* Шапка страницы
* @param string $title
* @param string $desc
* @param string $header
*/
function show_header($title = '', $keys = '', $desc = '', $header = 'Y') {
global $db, $uset, $config, $is_logged, $categories;
header('Content-Type: text/html; charset=utf-8');
$config['title'] = !empty($title) ? StripMeta($title) : $config['site_title'];
$config['keywords'] = !empty($keys) ? genKeywords($keys) : $config['site_keys'];
$config['description'] = !empty($desc) ? genDescription($desc) : $config['site_desc'];
$str = '<?xml version="1.0" encoding="utf-8"?><!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="viewport" content="width=device-width" /><meta name="keywords" content="' . $config['keywords'] . '" /><meta name="description" content="' . $config['description'] . '" /><style type="text/css">' . @file_get_contents(dirname(__FILE__) . '/style.css') . '</style>' . ($config['allow_rss'] == 1 ? '<link rel="alternate" type="application/rss+xml" title="' . $config['rss_title'] . '" href="/rss.xml" />' : '') . '<link rel="shortcut icon" href="/themes/default/favicon.ico" type="image/x-icon"/></head><body><!-- div class="nav" style="text-align:center;">' . date('H:i') . '</div -->';
$ex = explode('.', $config['site_name']);
$str .= '<div class="logoback"><table align="center"><tr>';
$str .= '<td><a href="/"><img src="/themes/default/images/logo.png" alt="" /></a></td>';
$str .= '<td align="left"><a href="/"><span class="name">' . $ex[0] . '</span><span class="tld">.' . $ex[1] . '</span></a><br />';
$str .= '<span class="title">' . $config['title'] . '</span></td></tr></table></div>';
//if (!$is_logged) {
$str .= '<div class="blocks"><table><tr>';
$str .= '<td class="w50"><a href="/chat/' . gen_uri('index', '', RND) . '">Чат</a></td>';
$str .= '<td class="w50"><a href="/blog/' . gen_uri('index', '', RND) . '">Блог</a></td>';
$str .= '</tr></table></div>';
/* }
else {
$str .= '<div class="blocks"><table><tr>';
$str .= '<td class="w20"><a href="' . gen_users($uset['uid'], 'start', '', RND) . '">Я</a></td>';
$str .= '<td class="w20"><a href="/chat/' . gen_uri('index', '', RND) . '">Чат</a></td>';
$str .= '<td class="w20"><a href="/blog/' . gen_uri('index', '', RND) . '">Блог</a></td>';
$str .= '<td class="w20"><a href="' . gen_users($uset['uid'], 'privat', '', RND) . '">Почта</a></td>';
$str .= '<td class="w20"><a href="/' . gen_uri('exit', '', RND) . '">Выход</a></td>';
$str .= '</tr></table></div>';
} */
if (!empty($_SESSION['core_message'][0][0]) && !empty($_SESSION['core_message'][0][1])) {
$str .= '<div class="message_' . $_SESSION['core_message'][0][0] . '">' . $_SESSION['core_message'][0][1] . '</div>';
unset($_SESSION['core_message']);
}
/*
if (defined('IS_INDEX')) {
echo loadTemplate( 'header_index' );
}
else {
echo loadTemplate( 'header' );
}
*/
echo $str;
}
# Ноги
function show_footer() {
global $db, $mts, $uset, $config, $is_logged;
$str = '';
if (!defined('IS_INDEX')) {
if (!empty($config['back'])) $str .= $config['back'];
else {
$str .= '<div class="link" id="down">';
$str .= '<a href="' . $config['site_url'] . '" title="Главная">На Главную</a></div>';
}
}
if (!$is_logged) {
$str .= '<div class="blocks"><table><tr>';
$str .= '<td style="width:50%"><a href="/' . gen_uri('login', '', RND) . '">Авторизация</a></td>';
$str .= '<td style="width:50%"><a href="/' . gen_uri('reg', '', RND) . '">Регистрация</a></td>';
$str .= '</tr></table></div>';
}
else {
$uset['users_newprivat'] = !empty($uset['users_newprivat']) ? num($uset['users_newprivat']) : 0;
if ($uset['users_newprivat'] > 0) {
$priv = ' + ' . $uset['users_newprivat'];
}
else $priv = '';
$str .= '<div class="blocks"><table><tr>';
$str .= '<td class="w20"><a href="' . gen_users($uset['uid'], 'start', '', RND) . '">Я</a></td>';
//$str .= '<td class="w20"><a href="/chat/' . gen_uri('index', '', RND) . '">Чат</a></td>';
//$str .= '<td class="w20"><a href="/blog/' . gen_uri('index', '', RND) . '">Блог</a></td>';
$str .= '<td class="w20"><a href="' . gen_users($uset['uid'], 'privat', '', RND) . '">Почта' . $priv . '</a></td>';
$str .= '<td class="w20"><a href="/' . gen_uri('exit', '', RND) . '">Выход</a></td>';
$str .= '</tr></table></div>';
}
$str .= '<div class="adv">';
$str .= '<a href="page.xhtml#banner"><img src="/themes/default/images/banner.gif" alt="" /></a>';
$str .= '</div>';
if ($config['show_ads'] == 1 && !defined('IS_ADMINKA')) {
$ads = $db->select("SELECT * FROM ?_ads WHERE (`ads_time` - UNIX_TIMESTAMP()) > 0 ORDER BY rand() LIMIT 0," . $config['ads_num']);
if (!empty($ads)) {
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>';
$str .= '<div class="link"><a href="/' . gen_uri('ads', $ad['ads_id'], RND) . '">' . $ad['ads_name'] . '</a></div>';
}
}
}
$str .= '<div class="copy">';
$str .= ' Copyright <a href="/">' . $config['site_copy'] . '</a> :: ' . date('Y');
if (!empty($config['allow_online'])) {
require_once( MODULES_PATH . 'online.inc.php' );
$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);
$str .= ' <span class="fr"><a href="/' . gen_uri('online', '', RND) . '">Онлайн: ' . $on['users'] . DS . $on['guest'] . '</a></span> ';
unset($on);
}
$str .= '</div>';
$str .= '</body></html>';
exit($str);
}
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 . '" class="ico"';
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="bl"><table><tr><td><img src="' . ICONS . 'infos.png" class="ico" alt="" /></td><td>';
$show .= $error . '</td></tr></table></div>';
if (!$return) echo $show;
else return $show;
}
function show_login($notice, $return = false) {
global $config;
$show = '<div class="bl"><table><tr><td><img src="' . ICONS . 'infos.png" class="ico" alt="" /></td><td>' . $notice;
$show .= ' <a href="' . $config['site_url'] . '/' . gen_uri('login', '', RND) . '"><b>Авторизоваться</b></a><br /> или в начале';
$show .= ' <a href="' . $config['site_url'] . '/' . gen_uri('reg', '', RND) . '"><b>Зарегистрироваться</b></a></div>';
$show .= '</td></tr></table></div>';
if (!$return) echo $show;
else return $show;
}
function show_link($uri, $name, $other = '') {
$other = !empty($other) ? ' <span class="count fr">' . $other . '</span>' : '';
$show = '<div class="link">';
$show .= '<a href="' . $uri . '" title="' . $name . '">' . $name . $other . '</a>';
$show .= '</div>';
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="bl">';
$str .= '<img src="/images/icons/star--arrow.png" alt="" /> ';
$str .= '<a href="' . $url . '#bookmarks">В закладки</a> (' . num($cnt) . ')<br /></div>';
return $str;
}
}
# Функция вывода рейтинга
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';
}
}
?>