Ниже два скрина одни как мне надо, а второй как у меня получается(
Помогите доделать))
Тонны кода надо прятать под спойлер (+/-)
<?php
/*
* JohnCMS NEXT Mobile Content Management System (http://johncms.com)
*
* For copyright and license information, please see the LICENSE.md
* Installing the system or redistributions of files must retain the above copyright notice.
*
* @link http://johncms.com JohnCMS Project
* @copyright Copyright (C) JohnCMS Community
* @license GPL-3
*/
define('_IN_JOHNCMS', 1);
$id = isset($_REQUEST['id']) ? abs(intval($_REQUEST['id'])) : 0;
$act = isset($_GET['act']) ? trim($_GET['act']) : '';
$mod = isset($_GET['mod']) ? trim($_GET['mod']) : '';
require('../system/bootstrap.php');
/** @var Psr\Container\ContainerInterface $container */
$container = App::getContainer();
/** @var PDO $db */
$db = $container->get(PDO::class);
/** @var Johncms\Api\UserInterface $systemUser */
$systemUser = $container->get(Johncms\Api\UserInterface::class);
/** @var Johncms\Api\ToolsInterface $tools */
$tools = $container->get(Johncms\Api\ToolsInterface::class);
/** @var Johncms\Api\ConfigInterface $config */
$config = $container->get(Johncms\Api\ConfigInterface::class);
/** @var Zend\I18n\Translator\Translator $translator */
$translator = $container->get(Zend\I18n\Translator\Translator::class);
$translator->addTranslationFilePattern('gettext', __DIR__ . '/locale', '/%s/default.mo');
// Закрываем от неавторизованных юзеров
if (!$systemUser->isValid()) {
require('../system/head.php');
echo $tools->displayError(_t('For registered users only'));
require('../system/end.php');
exit;
}
// Получаем данные пользователя
$user = $tools->getUser(isset($_REQUEST['user']) ? abs(intval($_REQUEST['user'])) : 0);
if (!$user) {
require('../system/head.php');
echo $tools->displayError(_t('This User does not exists'));
require('../system/end.php');
exit;
}
/**
* Находится ли выбранный пользователь в контактах и игноре?
*
* @param int $id Идентификатор пользователя, которого проверяем
* @return int Результат запроса:
* 0 - не в контактах
* 1 - в контактах
* 2 - в игноре у меня
*/
function is_contact($id = 0)
{
global $db, $systemUser;
static $user_id = null;
static $return = 0;
if (!$systemUser->isValid() && !$id) {
return 0;
}
if (is_null($user_id) || $id != $user_id) {
$user_id = $id;
$req = $db->query("SELECT * FROM `cms_contact` WHERE `user_id` = '" . $systemUser->id . "' AND `from_id` = '$id'");
if ($req->rowCount()) {
$res = $req->fetch();
if ($res['ban'] == 1) {
$return = 2;
} else {
$return = 1;
}
} else {
$return = 0;
}
}
return $return;
}
// Переключаем режимы работы
$array = [
'activity' => 'includes',
'ban' => 'includes',
'edit' => 'includes',
'images' => 'includes',
'info' => 'includes',
'ip' => 'includes',
'guestbook' => 'includes',
'karma' => 'includes',
'office' => 'includes',
'password' => 'includes',
'reset' => 'includes',
'settings' => 'includes',
'stat' => 'includes',
];
$path = !empty($array[$act]) ? $array[$act] . '/' : '';
if (isset($array[$act]) && file_exists($path . $act . '.php')) {
require_once($path . $act . '.php');
} else {
// Анкета пользователя
$headmod = 'profile,' . $user['id'];
$textl = _t('Profile') . ': ' . htmlspecialchars($user['name']);
require('../system/head.php');
echo '<div class="phdr"><b>' . ($user['id'] != $systemUser->id ? _t('User Profile') : _t('My Profile')) . '</b></div>';
// Меню анкеты
$menu = [];
if ($user['id'] == $systemUser->id || $systemUser->rights == 9 || ($systemUser->rights == 7 && $systemUser->rights > $user['rights'])) {
$menu[] = '<a href="?act=edit&user=' . $user['id'] . '">' . _t('Edit') . '</a>';
}
if ($user['id'] != $systemUser->id && $systemUser->rights >= 7 && $systemUser->rights > $user['rights']) {
$menu[] = '<a href="' . $config['homeurl'] . '/admin/index.php?act=usr_del&id=' . $user['id'] . '">' . _t('Delete') . '</a>';
}
if ($user['id'] != $systemUser->id && $systemUser->rights > $user['rights']) {
$menu[] = '<a href="?act=ban&mod=do&user=' . $user['id'] . '">' . _t('Ban') . '</a>';
}
if (!empty($menu)) {
echo '<div class="topmenu">' . implode(' | ', $menu) . '</div>';
}
//Уведомление о дне рожденья
if ($user['dayb'] == date('j', time()) && $user['monthb'] == date('n', time())) {
echo '<div class="gmenu">' . _t('Birthday') . '!!!</div>';
}
// Информация о юзере
$arg = [
'lastvisit' => 1,
'iphist' => 1,
'header' => '',
];
echo '<div class="user">' . $tools->displayUser($user, $arg) . '</div>';
if (file_exists('../files/users/photo/'.$user['id'].'.jpg')) {
$anhbia = '/files/users/photo/'.$user['id'].'.jpg';
}else{
if (file_exists(('../files/users/photo/' . $user['id'] . '.png'))) {
$anhbia = '/files/users/photo/'.$user['id'].'.png';
} else {
$anhbia = '/images/nofoto.jpg';
}
}
if (file_exists(('../files/users/avatar/' . $user['id'] . '.png'))) {
$ava = '/files/users/avatar/'.$user['id'].'.png';
} else {
$ava = '/images/empty.png';
}
$lgab = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$user['id']."' LIMIT 1"));
echo '<style>#profile{background:url('.$anhbia.') ;
height: 120px;
background-size: 100%;
background-repeat: no-repeat;
background-position: 50% 50%;
/* cursor: pointer; */
position: relative;
box-shadow: 0px 2px 2px #AEAEAE;
-webkit-box-shadow: 0px 2px 2px #AEAEAE;
-moz-box-shadow: 0px 2px 2px #AEAEAE;
}
.contect {
padding-top:40px;
padding-bottom:8px;
}
.anka {box-shadow: 0px 1px 2px #fff;
-webkit-box-shadow: 0px 1px 2px #fff;
-moz-box-shadow: 0px 1px 2px #fff;
background: #fff;
background: rgba(255,255,255,.6);
border: 1px solid #fff;
padding: 4px;
border-radius: 50%;
width: 20px;
height: 20px;
overflow: hidden;
position: absolute;
top: -110px;
right: 10px;
text-align: center;}
#pagina{width:100%;margin:0 auto;padding:0} #page_body{padding-top:2px;clear:both;margin:0} #wrapper{z-index:2;position:relative; margin-top:7px;}
</style>
<div id="profile"><DIV class="contect"><DIV id="pagina">
<DIV id="page_body">
<table cellpadding="0" cellspacing="0">
<tr><td>
<div style="WIDTH: 70px;
BACKGROUND: url('.$ava.') no-repeat;
HEIGHT: 70px;
background-size: 75px 75px;
-webkit-border-radius: 50%;
border-radius: 50%; -moz-border-radius: 50%;
margin-left:7px;
margin:1px 2px 2px 1px;
padding:2px;
box-shadow: 2px 2px 2px #3A4558;
"></div></td><td style="font-size: 16px; color: #fff; padding: 0px 0px 0px 5px;"></td></tr></table></div></div></div></div>';
if ($user['id'] != $systemUser->id) {
echo '<div class="dmenu">';
// Контакты
if (is_contact($user['id']) != 2) {
if (!is_contact($user['id'])) {
echo '<div class="topmenu"><a href="../mail/index.php?id=' . $user['id'] . '">' . _t('Add to Contacts') . '</a></div>';
} else {
echo '<div class="topmenu"><a href="../mail/index.php?act=deluser&id=' . $user['id'] . '">' . _t('Remove from Contacts') . '</a></div>';
}
}
if (is_contact($user['id']) != 2) {
echo '<div class="topmenu"><a href="../mail/index.php?act=ignor&id=' . $user['id'] . '&add">Заблокировать</a></div>';
} else {
echo '<div class="topmenu"><a href="../mail/index.php?act=ignor&id=' . $user['id'] . '&del">' . _t('Unlock User') . '</a></div>';
}
if (!$tools->isIgnor($user['id'])
&& is_contact($user['id']) != 2
&& !isset($systemUser->ban['1'])
&& !isset($systemUser->ban['3'])
) {
echo '<div class="topmenu"><a href="../mail/index.php?act=write&id=' . $user['id'] . '" method="post"> ' . _t('Write') . '</a></div>';
}
echo '</div>';
}
// Если юзер ожидает подтверждения регистрации, выводим напоминание
if ($systemUser->rights >= 7 && !$user['preg'] && empty($user['regadm'])) {
echo '<div class="rmenu">' . _t('Pending confirmation') . '</div>';
}
// Карма
if ($set_karma['on']) {
$karma = $user['karma_plus'] - $user['karma_minus'];
if ($karma > 0) {
$images = ($user['karma_minus'] ? ceil($user['karma_plus'] / $user['karma_minus']) : $user['karma_plus']) > 10 ? '2' : '1';
echo '<div class="gmenu">';
} else {
if ($karma < 0) {
$images = ($user['karma_plus'] ? ceil($user['karma_minus'] / $user['karma_plus']) : $user['karma_minus']) > 10 ? '-2' : '-1';
echo '<div class="alarm">';
} else {
$images = 0;
echo '<div class="menu">';
}
}
echo '<table width="100%"><tr><td width="22" valign="top"><img src="' . $config['homeurl'] . '/images/k_' . $images . '.gif"/></td><td>' .
'<b>' . _t('Karma') . '</b><span class="cnt"> ' . $karma . '</span><br />' .
'<div class="sub">' .
'<a href="?act=karma&user=' . $user['id'] . '&type=1"><i class="fas fa-thumbs-up"></i> ' . $user['karma_plus'] . '</a> ' .
'<a href="?act=karma&user=' . $user['id'] . '"><i class="fas fa-thumbs-down"></i> ' . $user['karma_minus'] . '</a>';
if ($user['id'] != $systemUser->id) {
if (!$systemUser->karma_off && (!$user['rights'] || ($user['rights'] && !$set_karma['adm'])) && $user['ip'] != $systemUser->ip) {
$sum = $db->query("SELECT SUM(`points`) FROM `karma_users` WHERE `user_id` = '" . $systemUser->id . "' AND `time` >= '" . $systemUser->karma_time . "'")->fetchColumn();
$count = $db->query("SELECT COUNT(*) FROM `karma_users` WHERE `user_id` = '" . $systemUser->id . "' AND `karma_user` = '" . $user['id'] . "' AND `time` > '" . (time() - 86400) . "'")->fetchColumn();
if (empty($systemUser->ban) && $systemUser->postforum >= $set_karma['forum'] && $systemUser->total_on_site >= $set_karma['karma_time'] && ($set_karma['karma_points'] - $sum) > 0 && !$count) {
echo '<br /><a href="?act=karma&mod=vote&user=' . $user['id'] . '">' . _t('Vote') . '</a>';
}
}
} else {
$total_karma = $db->query("SELECT COUNT(*) FROM `karma_users` WHERE `karma_user` = '" . $systemUser->id . "' AND `time` > " . (time() - 86400))->fetchColumn();
if ($total_karma > 0) {
echo '<br /><a href="?act=karma&mod=new">' . _t('New reviews') . '</a> (' . $total_karma . ')';
}
}
echo '</div></td></tr></table></div>';
}
// Меню выбора
$total_photo = $db->query("SELECT COUNT(*) FROM `cms_album_files` WHERE `user_id` = '" . $user['id'] . "'")->fetchColumn();
echo
'<div class="menu1"><a href="?act=info&user=' . $user['id'] . '"><i class="fas fa-address-card fa-fw"></i> ' . _t('Information') . '</a></div>' .
'<div class="menu1"><a href="?act=activity&user=' . $user['id'] . '"><i class="fas fa-star-half-alt fa-fw"></i> ' . _t('Activity') . '</a></div>' .
'<div class="menu1"><a href="?act=stat&user=' . $user['id'] . '"><i class="fas fa-chart-line fa-fw"></i> ' . _t('Statistic') . '</a></div>';
$bancount = $db->query("SELECT COUNT(*) FROM `cms_ban_users` WHERE `user_id` = '" . $user['id'] . "'")->fetchColumn();
if ($bancount) {
echo '<div class="menu1"><a href="?act=ban&user=' . $user['id'] . '"><i class="fas fa-ban fa-fw"></i> ' . _t('Violations') . '<span class="count"> ' . $bancount . '</span></a></div>';
}
echo '<div class="menu1"><a href="../album/index.php?act=list&user=' . $user['id'] . '"><i class="fas fa-image fa-fw"></i> ' . _t('Photo Album') . '<span class="count"> ' . $total_photo . '</span></a></div>';
echo '<div class="menu1"><a href="?act=guestbook&user=' . $user['id'] . '"><i class="fas fa-address-book fa-fw"></i> ' . _t('Guestbook') . ' <span class="count"> ' . $user['comm_count'] . '</span></a></div>';
}
require_once('../system/end.php');