<?php

define('_IN_JOHNCMS', 1);

$headmod = 'mainpage';

$rootpath = '';

require_once ('incfiles/core.php');
require_once ('incfiles/head1.php');

if (isset ($_GET['err']))
    $act = 404;
switch ($act) {
    case '404' :
        echo display_error('Запрошенная Вами страница отсутствует');
        break;

    case 'info' :
	if (!$user_id) {
$link='' . $home . '/aut.html';
header("Location: $link");exit;}
        echo '<div class="phdr"><b>Информация</b></div>';
        echo '<div><img src="' . $home . '/images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/str/smile.php">Смайлы</a><br />';
        echo '<img src="' . $home . '/images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/str/avatar.php">Аватары</a><br />';
        echo '<img src="' . $home . '/images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/read.php?">FAQ (ЧаВо)</a></div>';
        //TODO: Разобраться с сессией, по возможности удалить
        $_SESSION['refsm'] = '../index.php?act=info';
        break;

    case 'cab' :
        if (!$user_id) {
            echo display_error('Только для зарегистрированных');
            require_once ('incfiles/end.php');
            exit;
        }
$sqlprov = mysql_query("select * from fr where fr2 = '".$id."' AND fr1 = '".$user_id."'");
$provr = mysql_fetch_assoc($sqlprov);
$prov = $provr['st'];
$count_mail = mysql_result(mysql_query("SELECT COUNT(*) FROM `privat` WHERE `user` = '$login' AND `type` = 'in'"), 0);
$count_newmail = mysql_result(mysql_query("SELECT COUNT(*) FROM `privat` WHERE `user` = '" . $login . "' AND `type` = 'in' AND `chit` = 'no'"), 0);
$k_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `present` WHERE `podarili`='$user_id'"), 0);
$stt = mysql_result(mysql_query("SELECT COUNT(*) FROM `wall_users` WHERE `user_wall`='$user_id'"), 0);
$count_friends = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user` = '$user_id' AND `preg` = '1'"), 0);
        $count_friends_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user` = '$user_id' AND `preg` = '0'"), 0);
        if ($count_friends_new)
            $fnew = '<a href="str/friends.php?act=new"><span class="red">/+' . $count_friends_new . '</span></a>';
        else
            $fnew = '';        
		echo '<div class="phdr"><b>Личный кабинет</b></div>';
		echo '<div class="gmenu">';
		echo '<img src="' . $home . '/images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/anketa.html">Моя Страница</a> [<a href="' . $home . '/str/my_data.php">ред.</a>]<br />';
		echo '<img src="' . $home . '/images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/str/friends.php">Мои Друзья</a>&nbsp;[' . $count_friends . $fnew . ']<br />';
		echo '<img src="' . $home . '/images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/foto/index.php?mod=user_albom&amp;id='.$user_id.'">Мои Фотоальбомы</a> ['.mysql_result(mysql_query("SELECT COUNT(*) FROM `foto_albom` WHERE id_user = '$user_id'"), 0).']<br />';
		echo '<img src="' . $home . '/images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/messages.html">Мои Сообщения</a> [' . $count_mail . ($count_newmail ? '&nbsp;/&nbsp;<span class="red"><a href="' . $home . '/str/pradd.php?act=in&amp;new">+' . $count_newmail . '</a></span>' : '') . ']<br />';
		echo '<img src="' . $home . '/images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/ustena.html">Моя Стена</a> [' . $stt . ']<br />';
		echo '<img src="' . $home . '/images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/blogs/blogs.php">Мой Дневник</a><br />';
		echo '<img src="' . $home . '/images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/present/?">Мои Подарки</a> [' . $k_p . ']<br />';
		echo '<img src="' . $home . '/images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/stat.html">Моя Статистика</a><br />';
        echo '<img src="' . $home . '/images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/settings.html">Мои Настройки</a><br />';

       
        if ($rights >= 6) {
            $guest = gbook(2);
            echo '<img src="images/act3.gif" width="7" height="10" alt="-" /> <a href="str/guest.php?act=ga&amp;do=set">Админ-Клуб</a> [<span class="red">' . $guest . '</span>]<br />';
            echo '<img src="images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $admp . '/index.php">Админ панель</a><br />';
        }
        
		echo '<img src="images/act3.gif" width="7" height="10" alt="-" /> <a href="' . $home . '/exit.html">Выход</a> [покинуть сайт]</div>';
        break;

    default :
        include_once 'pages/mainmenu.php';
}

require_once ('incfiles/end.php');

?>