Файл: chat/profile.php
Строк: 170
<?php
/**
* @package Chat for JohnCMS
* @link http://johncms.com
* @copyright Copyright (C) 2010-2017 k_2
* @license LICENSE.txt (see attached file)
* @version VERSION.txt (see attached file)
* @author http://johncms.com/profile/?user=6251
*/
define('_IN_JOHNCMS', 1);
$headmod = 'profile';
require('../incfiles/core.php');
$lng_profile = core::load_lng('profile');
$lng_chat_faq = core::load_lng('chat_faq');
/*
-----------------------------------------------------------------
Закрываем от неавторизованных юзеров
-----------------------------------------------------------------
*/
if (!$user_id) {
require('../incfiles/head.php');
echo functions::display_error($lng['access_guest_forbidden']);
require('../incfiles/end.php');
exit;
}
/*
-----------------------------------------------------------------
Получаем данные бота
-----------------------------------------------------------------
*/
if (!$user) {
header("Location: $home/users/profile.php");
exit;
}
$bot = db::query("SELECT `name`, `tip`, `mass_bot`, `mass_author` FROM `chat_bot` WHERE `id` = '" . $user . "' LIMIT 1");
$bot_d = mysqli_fetch_assoc($bot);
$mass_bot = unserialize($bot_d['mass_bot']);
$mass_author = unserialize($bot_d['mass_author']);
if (!mysqli_num_rows($bot) || empty($mass_bot)) {
header("Location: $home/users/profile.php");
exit;
}
switch ($act) {
case 'bot_info':
$textl = htmlspecialchars($bot_d['name']) . ': ' . $lng['information'];
require('../incfiles/head.php');
echo '<div class="phdr"><a href="profile.php?user=' . $user . '"><b>' . $lng['profile'] . '</b></a> | ' . $lng['information'] . '</div>' .
'<div class="gmenu"><b>' . $lng_chat_faq['bot_no_func'] . '</b></div>' .
'<div class="phdr"><a href="profile.php?user=' . $user . '">' . $lng['back'] . '</a></div>';
break;
case 'info':
/*
-----------------------------------------------------------------
Подробная информация, контактные данные
-----------------------------------------------------------------
*/
$textl = htmlspecialchars($bot_d['name']) . ': ' . $lng['information'];
require('../incfiles/head.php');
echo '<div class="phdr"><a href="profile.php?user=' . $user . '"><b>' . $lng['profile'] . '</b></a> | ' . $lng['information'] . '</div>';
if ($rights == 9)
echo '<div class="topmenu"><a href="menu.php?act=mod_bots&mod=edit&id=' . $user . '">' . $lng['edit'] . '</a></div>';
// Информация о боте
echo '<div class="user"><p>';
if ($set_user['avatar']) {
echo '<table cellpadding="0" cellspacing="0"><tr><td>';
if (file_exists(('img/' . $mass_bot['av']) . '.png'))
echo '<img src="img/' . $mass_bot['av'] . '.png" width="32" height="32" alt="" /> ';
else
echo '<img src="' . $set['homeurl'] . '/images/empty.png" width="32" height="32" alt="" /> ';
echo '</td><td>';
}
if ($mass_bot['sex'])
$sex = ($mass_bot['sex'] == 'm' ? 'm' : 'w') . '.png';
else
$sex = 'del.png';
echo functions::image($sex, array('class' => 'icon-inline')) . ' ' .
'<a href="' . $set['homeurl'] . '/chat/profile.php?user=' . $user . '"><b>' . $bot_d['name'] . '</b></a>' .
'<span class="green"> [ON]</span>';
if (!empty($mass_bot['status']))
echo '<div class="status">' . functions::image('label.png', array('class' => 'icon-inline')) . ' ' . $mass_bot['status'] . '</div>';
if ($set_user['avatar'])
echo '</td></tr></table>';
echo '</p></div>' .
'<div class="list2"><p><h3><img src="../images/contacts.png" width="16" height="16" class="left" /> ' . $lng_profile['personal_data'] . '</h3><ul>' .
'<li><span class="gray">' . $lng_profile['about'] . ':</span> ' . (empty($mass_author['description']) ? '' : '<br />' . functions::smileys(bbcode::tags($mass_author['description']))) . '</li></ul></p><p>';
if (($mass_author['author_email'] || $mass_author['author_url']) && $rights >= 7) {
echo '<h3><img src="../images/mail.png" width="16" height="16" class="left" /> ' . $lng_chat_faq['communication_author'] . '</h3><ul>';
if ($mass_author['author_email'])
echo '<li><span class="gray">E-mail:</span> ' . $mass_author['author_email'] . '<span class="gray"> [' . $lng_profile['hidden'] . ']</span></li>';
if ($mass_author['author_url'])
echo '<li><span class="gray">' . $lng_profile['site'] . ':</span> ' . bbcode::tags($mass_author['author_url']) . '</li>';
echo '</ul>';
}
echo '</p></div><div class="phdr"><a href="profile.php?user=' . $user . '">' . $lng['back'] . '</a></div>';
break;
default :
/*
-----------------------------------------------------------------
Анкета бота
-----------------------------------------------------------------
*/
$textl = $lng['profile'] . ': ' . htmlspecialchars($bot_d['name']);
require('../incfiles/head.php');
echo '<div class="phdr"><b>' . $lng_profile['user_profile'] . '</b></div>';
// Меню анкеты
if ($rights == 9)
echo '<div class="topmenu"><a href="menu.php?act=mod_bots&mod=edit&id=' . $user . '">' . $lng['edit'] . '</a></div>';
// Информация о боте
echo '<div class="user"><p>';
if ($set_user['avatar']) {
echo '<table cellpadding="0" cellspacing="0"><tr><td>';
if (file_exists(('img/' . $mass_bot['av'] . '.png')))
echo '<img src="img/' . $mass_bot['av'] . '.png" width="32" height="32" alt="" /> ';
else
echo '<img src="' . $set['homeurl'] . '/images/empty.png" width="32" height="32" alt="" /> ';
echo '</td><td>';
}
if ($mass_bot['sex'])
$sex = ($mass_bot['sex'] == 'm' ? 'm' : 'w') . '.png';
else
$sex = 'del.png';
echo functions::image($sex, array('class' => 'icon-inline')) . ' ' .
'<a href="' . $set['homeurl'] . '/chat/profile.php?user=' . $user . '"><b>' . $bot_d['name'] . '</b></a>' .
'<span class="green"> [ON]</span>';
if (!empty($mass_bot['status']))
echo '<div class="status">' . functions::image('label.png', array('class' => 'icon-inline')) . ' ' . $mass_bot['status'] . '</div>';
if ($set_user['avatar'])
echo '</td></tr></table>';
echo '</p></div>';
// Карма
if ($set_karma['on']) {
echo '<div class="menu">' .
'<table width="100%"><tr><td width="22" valign="top"><img src="' . $set['homeurl'] . '/images/k_0.gif"/></td><td>' .
'<b>' . $lng['karma'] . ' (0)</b>' .
'<div class="sub">' .
'<span class="green"><a href="profile.php?act=bot_info&user=' . $user . '">' . $lng['vote_for'] . ' (0)</a></span> | ' .
'<span class="red"><a href="profile.php?act=bot_info&user=' . $user . '">' . $lng['vote_against'] . ' (0)</a></span>' .
'</div></td></tr></table></div>';
}
// Меню выбора
echo '<div class="list2"><p>' .
'<div><img src="../images/contacts.png" width="16" height="16"/> <a href="profile.php?act=info&user=' . $user . '">' . $lng['information'] . '</a></div>' .
'<div><img src="../images/activity.gif" width="16" height="16"/> <a href="profile.php?act=bot_info&user=' . $user . '">' . $lng_profile['activity'] . '</a></div>' .
'<div><img src="../images/rate.gif" width="16" height="16"/> <a href="profile.php?act=bot_info&user=' . $user . '">' . $lng['statistics'] . '</a></div>' .
'<br />' .
'<div><img src="../images/photo.gif" width="16" height="16"/> <a href="profile.php?act=bot_info&user=' . $user . '">' . $lng['photo_album'] . '</a> (0)</div>' .
'<div><img src="../images/guestbook.gif" width="16" height="16"/> <a href="profile.php?act=bot_info&user=' . $user . '">' . $lng['guestbook'] . '</a> (0)</div>' .
'<br /><div><img src="../images/users.png" width="16" height="16"/> <a href="profile.php?act=bot_info&user=' . $user . '">' . $lng['contacts_in'] . '</a></div>' .
'<div><img src="../images/write.gif" width="16" height="16"/> <a href="profile.php?act=bot_info&user=' . $user . '"><b>' . $lng['write'] . '</b></a></div>' .
'</p></div>' .
'<div class="phdr"><a href="../users/index.php">' . $lng['users'] . '</a></div>';
}
require_once('../incfiles/end.php');