<?php
// by Mike O. (mides), coolcms.mobi
require_once 'system/sys.php';
require_once 'system/header.php';
$user_r = mysql_query("SELECT * FROM `users` WHERE `id` = '$id'");
$user = mysql_fetch_assoc($user_r);
if (!$user['id']) {
redirect(HTTPHOME);
}
switch ($act) {
default:
echo '<div class="title">'.username($id).' ('.access2($id).') [id: '.$id.']</div>';
$ban_r = mysql_query("SELECT * FROM `ban` WHERE `id_user` = '$id' and `until` > '".TIME."'");
$ban = mysql_fetch_assoc($ban_r);
if ($ban['id']) {
echo '<div class="main">';
if ($ban['reason']) {
echo username($ban['by']).' выдал бан до '.ccdate($ban['until'], 0).'<br />
Причина: '.$ban['reason'].'<br />';
} else {
echo username($ban['by']).' пнул этого юзера<br />';
}
echo '</div>';
}
echo '<div class="main">';
note();
$online_r = mysql_query("SELECT `id` FROM `online` WHERE `id_user` = '$id'");
if (mysql_num_rows($online_r)) {
echo '<font color="green">On-line</font>';
} else {
echo '<font color="red">Off-line</font><br />Посл. визит: '.ccdate($user['lastvisit'], 0);
}
echo '<br />';
if ($user['name']) echo $lang['name'].': <b>'.$user['name'].'</b><br />';
switch ($user['gender']) {
case '1': $gender = $lang['male']; break;
case '2': $gender = $lang['female']; break;
}
if (isset($gender)) echo $lang['gender'].': '.$gender.'<br />';
if ($user['from']) echo $lang['from'].': '.$user['from'].'<br />';
if ($user['birthday']) echo $lang['birthday'].': '.$user['birthday'].'<br />';
echo $lang['Karma'].': '.$user['karma'];
if (isset($u['id']) and $u['id'] != $id) {
echo ' <a href="?act=vote&id='.$id.'&type=1"><img src="inc/minus.png"></a> <a href="?act=vote&id='.$id.'&type=2"><img src="inc/plus.png"></a>';
}
echo '<br />';
if ($user['icq']) echo '<img src="http://web.icq.com/whitepages/online?icq='.$user['icq'].'&img=27" alt="icq" /> ICQ: '.$user['icq'].'<br />';
if ($user['skype']) echo '<img src="http://mystatus.skype.com/smallicon/'.$user['skype'].'" alt="skype" /> Skype: '.$user['skype'].'<br />';
if ($user['site']) echo 'Wap-site: <a href="http://'.$user['site'].'">'.$user['site'].'</a><br />';
if ($user['about']) echo $lang['about_myself'].': '.$user['about'].'<br />';
echo $lang['Registration'].': '.ccdate($user['regtime'], 0).'<br />';
$banhist = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `ban` WHERE `id_user` = '$id'"), 0);
echo '<a href="?act=banhist&id='.$id.'">Строгих нарушений: '.$banhist.'</a><br />';
echo '<a href="?act=ftopics&id='.$id.'">'.$lang['forum'].'</a> (<a href="?act=fposts&id='.$id.'">'.$lang['posts'].'</a>) / <a href="?act=lfiles&id='.$id.'">'.$lang['dl'].'</a> (<a href="?act=lcomm&id='.$id.'">'.$lang['comm'].'</a>)';
echo '</div>';
if (isset($u['id'])) {
echo '<div class="main">';
if ($u['id'] == $id) {
echo '<a href="main.php?act=edit">'.$lang['profile'].'</a>, <a href="main.php?act=set">'.$lang['settings'].'</a>';
} else {
echo '';
$friend_r = mysql_query("SELECT `id` FROM `my_friends` WHERE `id_user` = '$id' and `is_friend_of` = ".$u['id']." ");
$blacklist_r = mysql_query("SELECT `id` FROM `blacklist` WHERE `id_user` = '$id' and `blacklisted_by` = ".$u['id']." ");
if (mysql_num_rows($friend_r)) {
echo '<a href="main.php?act=send&id='.$id.'">Написать</a> вашему другу';
} elseif (mysql_num_rows($blacklist_r)) {
echo 'В <a href="main.php?act=blacklist">черном списке</a>';
} else {
echo '<a href="main.php?act=send&id='.$id.'">Написать</a>, <a href="?act=addfriend&id='.$id.'">в друзья</a> | <a href="?act=blacklist&id='.$id.'">Х</a>';
}
}
}
echo '</div>';
if (access(1)) {
$lang['for_n_sec'] = str_replace('%n%', $config['kick'], $lang['for_n_sec']);
echo '</div><div class="main">
- <a href="panel/index.php?act=kick&user='.$user['username'].'">'.$lang['Kick'].'</a> ('.$lang['for_n_sec'].')<br />';
if (access(2)) echo '- <a href="panel/index.php?act=ban&user='.$user['username'].'">Забанить</a>, <a href="?act=delmsg&id='.$id.'">уд. сообщ.</a><br />';
if (access(3)) echo '- <a href="panel/users.php?act=edit&id='.$user['id'].'">'.$lang['edit'].'</a> | <a href="panel/users.php?act=del&id='.$user['id'].'">'.$lang['delete'].'</a>';
}
nav_main();
break;
case 'ftopics':
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_topics` WHERE `id_user` = '$id'"), 0);
if ($total > 0) {
tp('Все темы '.username($id));
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
$topics_r = mysql_query("SELECT * FROM `forum_topics` WHERE `id_user` = '$id' ORDER BY `last_time` DESC LIMIT $begin, $config[onpage]");
while ($topic = mysql_fetch_assoc($topics_r)) {
if ($topic['stuck']) echo '!';
if ($topic['closed'] == 1 and empty($topic['stuck'])) echo '#';
$t_msg = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_msg` WHERE `id_topic` = '$topic[id]'"), 0);
// getting last user id from forum_msg
$last_user_r = mysql_query("SELECT `id_user` FROM `forum_msg` WHERE `id_topic` = '$topic[id]' ORDER BY `time` DESC LIMIT 1");
$last_user = mysql_fetch_assoc($last_user_r);
// getting last page
$last_page = ceil($t_msg / $config['onpage']);
// output
echo '<a href="forum.php?act=topic&id='.$topic['id'].'">'.$topic['title'].'</a> ('.$t_msg.') '.login($last_user['id_user']).'<a href="forum.php?act=topic&id='.$topic['id'].'&p='.$last_page.'">»</a><br />';
}
navig($page, '?act=ftopics&id='.$id.'&', $pages);
} else {
error($lang['nothing_yet']);
}
nav('?id='.$id);
break;
case 'fposts':
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_msg` WHERE `id_user` = '$id'"), 0);
if ($total > 0) {
echo '<div class="title">Сообщения '.username($id).'</div><div class="list">';
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
$msg_r = mysql_query("SELECT * FROM `forum_msg` WHERE `id_user` = '$id' ORDER BY `time` DESC LIMIT $begin, $config[onpage]");
while ($msg = mysql_fetch_assoc($msg_r)) {
if (!isset($num) ) $num = 1;
$num++;
$row_class = (!($num % 2)) ? 'row1' : 'row2';
echo '<div class="'.$row_class.'">'.bb($msg['text']).'<a href="forum.php?act=topic&id='.$msg['id_topic'].'">»</a> </div>';
}
navig($page, '?act=fposts&id='.$id.'&', $pages);
} else {
error($lang['nothing_yet']);
}
nav('?id='.$id);
break;
case 'lcomm':
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `loads_comm` WHERE `id_user` = '$id'"), 0);
if ($total > 0) {
echo '<div class="title">Комментарии в ЗЦ '.username($id).'</div><div class="list">';
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
$comm_r = mysql_query("SELECT * FROM `loads_comm` WHERE `id_user` = '$id' ORDER BY `time` DESC LIMIT $begin, $config[onpage]");
while ($comm = mysql_fetch_assoc($comm_r)) {
if (!isset($num) ) $num = 1;
$num++;
$row_class = (!($num % 2)) ? 'row1' : 'row2';
echo '<div class="'.$row_class.'">'.bb($comm['text']).'<a href="loads.php?act=comm&id='.$comm['id_loads'].'">»</a> </div>';
}
navig($page, '?act=lcomm&id='.$id.'&', $pages);
} else {
error($lang['nothing_yet']);
}
nav('?id='.$id);
break;
case 'lfiles':
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `loads` WHERE `id_user` = '$id'"), 0);
if ($total > 0) {
echo '<div class="title">Все загрузки '.username($id).'</div><div class="list">';
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
$loads_r = mysql_query("SELECT * FROM `loads` WHERE `id_user` = '$id' ORDER BY `time` DESC LIMIT $begin, $config[onpage]");
while ($load = mysql_fetch_assoc($loads_r)) {
if (!isset($num) ) $num = 1;
$num++;
$row_class = (!($num % 2)) ? 'row1' : 'row2';
$comm = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `loads_comm` WHERE `id_loads` = '$load[id]'"), 0);
$subcat = mysql_fetch_assoc(mysql_query("SELECT * FROM `loads_subcats` WHERE `id` = '$load[id_subcat]'"));
echo '<div class="'.$row_class.'">
<a href="loads.php?act=view&id='.$load['id'].'">'.$load['name'].'</a> ('.size(filesize('inc/loads/'.$subcat['path'].'/'.$load['file'])).')';
echo '<br />Комментарий: '.$comm.'<br />
</div>';
}
navig($page, '?act=lfiles&id='.$id.'&', $pages);
} else {
error($lang['nothing_yet']);
}
nav('?id='.$id);
break;
case 'addfriend':
if ($id !== $u['id']) {
$friend_r = mysql_query("SELECT `id` FROM `my_friends` WHERE `id_user` = '$id' and `is_friend_of` = ".$u['id']." ");
if (!mysql_num_rows($friend_r)) {
$blacklist_r = mysql_query("SELECT `id` FROM `blacklist` WHERE `id_user` = '$id' and `blacklisted_by` = ".$u['id']." ");
if (!mysql_num_rows($blacklist_r)) {
mysql_query("INSERT INTO `my_friends` SET `id_user` = '$id', `is_friend_of` = ".$u['id']." ");
} else {
$_SESSION['note'] = 'Этот юзер у вас в черном списке.';
}
}
}
redirect('?id='.$id);
break;
case 'blacklist':
if ($id !== $u['id']) {
$blacklist_r = mysql_query("SELECT `id` FROM `blacklist` WHERE `id_user` = '$id' and `blacklisted_by` = ".$u['id']." ");
if (!mysql_num_rows($blacklist_r)) {
$friend_r = mysql_query("SELECT `id` FROM `my_friends` WHERE `id_user` = '$id' and `is_friend_of` = ".$u['id']." ");
if (!mysql_num_rows($friend_r)) {
mysql_query("INSERT INTO `blacklist` SET `id_user` = '$id', `blacklisted_by` = ".$u['id']." ");
} else {
mysql_query("DELETE FROM `my_friends` WHERE `id_user` = '$id' and `is_friend_of` = '$u[id]'");
mysql_query("INSERT INTO `blacklist` SET `id_user` = '$id', `blacklisted_by` = ".$u['id']." ");
$_SESSION['note'] = 'Юзер теперь не ваш друг, он в черном списке.';
}
}
}
redirect('?id='.$id);
break;
case 'vote':
if ($u['id'] and $u['id'] != $id) {
$query = mysql_query("SELECT `id` FROM `voting` WHERE `type` = 'profile' and `id_who` = '$u[id]' and `id_for` = '$id'");
if (!mysql_num_rows($query)) {
$type = abs(intval($_GET['type']));
switch ($type) {
case '1': $value = -1; sendpm($id, 'Вас минусанули :('); break;
default: $value = 1; sendpm($id, 'Вас плюсанули :)'); break;
}
mysql_query("UPDATE `users` SET `karma` = (`karma`+$value) WHERE `id` = '$id'");
mysql_query("INSERT INTO `voting` SET `type` = 'profile', `id_who` = '$u[id]', `id_for` = '$id'") or die(mysql_error());
} else {
$_SESSION['note'] = 'Вы уже голосовали за этого юзера.';
}
}
redirect('?id='.$id);
break;
case 'banhist':
echo '<div class="title">История банов</div>';
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `ban` WHERE `id_user` = '$id'"), 0);
if ($total > 0) {
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
echo '</div><div class="list">';
$ban_r = mysql_query("SELECT * FROM `ban` WHERE `id_user` = '$id' ORDER BY `until` DESC LIMIT ".$begin.", ".$config['onpage']."");
while ($ban = mysql_fetch_assoc($ban_r)) {
if (!isset($num) ) $num = 1;
$num++;
$row_class = (!($num % 2)) ? 'row1' : 'row2';
echo '<div class="'.$row_class.'">
'.username($ban['by']).' выдал бан до '.ccdate($ban['until'], 0).'<br />Причина: '.$ban['reason'].'<br />
</div>';
}
} else {
echo 'История банов пуста';
}
nav('?id='.$id);
break;
case 'delmsg':
if (access(2)) {
if ($ok) {
if ($_POST['del_book']) {
mysql_query("DELETE FROM `book` WHERE `id_user` = '$id'");
}
if ($_POST['del_msg']) {
mysql_query("DELETE FROM `forum_msg` WHERE `id_user` = '$id'");
}
if ($_POST['del_topics']) {
mysql_query("DELETE FROM `forum_topics` WHERE `id_user` = '$id'");
}
if ($_POST['del_notes']) {
mysql_query("DELETE FROM `blogs` WHERE `id_user` = '$id'");
}
if ($_POST['del_cnews']) {
mysql_query("DELETE FROM `news_comm` WHERE `id_user` = '$id'");
}
if ($_POST['del_cblog']) {
mysql_query("DELETE FROM `blog_comm` WHERE `id_user` = '$id'");
}
if ($_POST['del_cdl']) {
mysql_query("DELETE FROM `loads_comm` WHERE `id_user` = '$id'");
}
$_SESSION['note'] = 'Успешно удалено.';
redirect('?id='.$id);
} else {
tp('Что удалить?');
echo '<form name="form" action="?act=delmsg&id='.$id.'&ok=1" method="post" name="form">
<input name="del_book" type="checkbox" value="1" />все сообщ. в гостевой<br />
<input name="del_msg" type="checkbox" value="1" />все сообщ. форуме<br />
<input name="del_topics" type="checkbox" value="1" />все темы в форуме<br />
<input name="del_notes" type="checkbox" value="1" />все записи в блоге<br />
<input name="del_cnews" type="checkbox" value="1" />все ком. (в новостях)<br />
<input name="del_cblog" type="checkbox" value="1" />все ком. (в блогах)<br />
<input name="del_cdl" type="checkbox" value="1" />все ком. (в ЗЦ)<br />
<input name="submit" type="submit" value="Go!" /></form>';
}
nav('?id='.$id);
} else {
redirect(HTTPHOME);
}
break;
}
require_once 'system/tail.php';
?>