View file social/sys/fnc/aut.php

File size: 3.51Kb
<?
function title()
{
	global $user;	
	
	if (isset($user))
	{
		global $set;		
		
		if ($set['web'] == false)
		{			
		
				$k_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` AS m,
		        (SELECT MAX(id) AS id FROM `mail` WHERE `unlink` != '$user[id]' AND (`id_kont` = '$user[id]') GROUP BY IF(`id_user` = '$user[id]', `id_kont`, `id_user`)) as max
		        WHERE m.id = max.id AND m.read = '0' AND (m.id_kont = '$user[id]') AND m.unlink != '$user[id]'"), 0);
	 
			 $lenta = mysql_result(mysql_query("SELECT COUNT(`read`) FROM `tape` WHERE `id_user` = '$user[id]' AND `read` = '0' "),0); // Лента			
			 
			 $discuss = mysql_result(mysql_query("SELECT COUNT(`count`) FROM `discussions` WHERE `id_user` = '$user[id]' AND `count` > '0' "),0); // Обсуждения			
			 
			 $k_frend = mysql_result(mysql_query("SELECT COUNT(id) FROM `frends_new` WHERE `to` = '$user[id]'"), 0); // Друзья			
			 
			 $k_notif = mysql_result(mysql_query("SELECT COUNT(`read`) FROM `notification` WHERE `id_user` = '$user[id]' AND `read` = '0'"), 0); // Уведомления			 
			 
        echo "<nav class='navbar navbar-light' style='
        background-color: #2a4056;
        color: #fff;'>";
        echo "<ul class='nav navbar-nav'>";

			if ($k_new != 0)
			{				
?><li class="nav-item"><a href="/new_mess.php" class="nav-link"><i class="fa fa-envelope fa-fw"></i> <?=$k_new?></a></li><?
			}
			
		if ($lenta > 0)
			{
				$j2 = 'tape';
			}
			elseif ($discuss > 0)
			{
				$j2 = 'discussions';
			}
			elseif ($k_notif > 0)
			{
				$j2 = 'notification';
			}
			else
			{
				$j2 = 'tape';
			}
			
			// Cкладываем сумму счетчиков
			$k_l = $lenta + $k_notif + $discuss;
			
			if($k_l > 0)
			{
?><li class="nav-item"><a href="/user/<?=$j2?>/index.php" class="nav-link"><i class="fa fa-bell"></i> <?=$k_l?></a></li><?
			}

			if ($k_frend > 0)
			{
?><li class="nav-item"><a href="/user/frends/new.php" class="nav-link"><i class="fa fa-user-plus fa-fw"></i> <?=$k_frend?></a></li><?
			}
			?>
        <div class="modal fade bd-example-modal-sm" id='menu_aut' tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-sm">

                <a class="list-group-item" href="/index.php"><i class="fa fa-home fa-fw"></i> Главная</a>
				<a class="list-group-item" href="/info.php"><i class="fa fa-user fa-fw"></i> Моя страница</a>
                <a class="list-group-item" href="/umenu.php"><i class="fa fa-cogs fa-fw"></i> Мой Кабинет</a>
                <a class="list-group-item" href="/user/info/settings.php"><i class="fa fa-cog fa-fw"></i> Мои Настройки</a>
                <a class="list-group-item" href="/konts.php"><i class="fa fa-envelope fa-fw"></i> Мои Сообщения</a>
                <a class="list-group-item" href="/user/notification/"><i class="fa fa-bell fa-fw"></i> Мои Уведомления</a>
                <a class="list-group-item" href="/exit.php"><i class="fa fa-sign-in fa-fw"></i> Выход</a>

            </div>
        </div>
        <div class="dropdown" style="float: right;">
            <?php
                echo "<span data-toggle='tooltip' data-placement='left' title='Меню'><a data-toggle='modal' data-target='#menu_aut' class='nav-link'>";
            ?>
            <i class="fa fa-navicon"></i>
        </a>

        </span>
        </div>
        </ul>

        </nav>
		<?
		}
    } else {
       
    }
}
?>