Файл: page.php
Строк: 193
<?php
/**
* @package Prime Social
* @link http://primesocial.ru
* @copyright Copyright (C) 2016 Prime Social
* @author BoB | http://primesocial.ru/about
*/
require_once('core/start.php');
check_auth();
if (empty($_GET['id'])) {
$page = DB::$dbs->queryFetch("SELECT * FROM ".USERS." WHERE `user_id` = ?",array(num($_SESSION['user_id'])));
} else {
$page = DB::$dbs->queryFetch("SELECT * FROM ".USERS." WHERE `user_id` = ?",array(num($_GET['id'])));
}
if (empty($page)) {
head('Xatolik!');
echo DIV_TITLE . 'Sahifa mavjud emas' . CLOSE_DIV;
echo DIV_ERROR . 'Foydalanuvchi topilmadi' . CLOSE_DIV;
require_once('core/stop.php');
exit();
}
switch ($select) {
default:
head('' . $page['name']);
require_once(inc.'style/themes/' .$styler. '/userpage.php');
$array = array();
nav($array);
break;
case 'soo':
head('Guruhga taklif');
if ($user['user_id'] != $page['user_id'] && DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".GROUPS." WHERE `user_id` = ?", array($user['user_id'])) == TRUE) {
$group = DB::$dbs->queryFetch("SELECT * FROM ".GROUPS." WHERE `user_id` = ? LIMIT 1",array($user['user_id']));
if (DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".GROUPS_PEOPLES." WHERE `group_id` = ? && `user_id` = ?", array($group['id'], $page['user_id'])) == FALSE) {
if (DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".GROUPS_APPS." WHERE `group_id` = ? && `user_id` = ? ", array($group['id'], $user['user_id'])) == TRUE) {
echo DIV_BLOCK . 'Siz ushbu foydalanuvchiga taklif jo`natgansiz' . CLOSE_DIV;
} else {
if (!empty($_POST['send'])) {
/* Habarni shakllantiramiz */
$msg = '<a href="'.HOME.'/id'.$user['user_id'].'">'.$user['nick'].'</a> sizni <a href="'.HOME.'/groups/'.$group['id'].'/"><b>'.$group['name'].'</b></a> guruhiga taklif etyapti. Sizning harakatingiz: <a href="'.HOME.'/groups/app/'.$group['id'].'/?yes"><b>A`zo bo`lish</b></a> / <a href="'.HOME.'/groups/app/'.$group['id'].'/?no"><b>Rad etish</b></a>';
lenta($msg, $page['user_id']);
DB::$dbs->query("INSERT INTO ".GROUPS_APPS." (`group_id`, `user_id`, `friend_id`) VALUES (?, ?, ?)", array($group['id'], $user['user_id'], $page['user_id']));
echo DIV_BLOCK . 'Taklif muvaffaqiyatli jo`natildi' . CLOSE_DIV;
}
echo DIV_BLOCK . '<a href="'.HOME.'/groups/'.$group['id'].'/"><b>' . $group['name'] . '</b></a> ga taklif etmoqchisizmi?<br /><br />'
. '<form action="#" method="POST">'
. '<input type="submit" name="send" value="HA" />'
. '</form>'
. CLOSE_DIV;
}
}
} else {
echo DIV_BLOCK . 'Xatolik!' . CLOSE_DIV;
}
echo DIV_LI . '<a href="'.HOME.'/id'.$page['user_id'].'"><b>Sahifaga qaytish</b></a>' . CLOSE_DIV;
$array = array();
nav($array);
break;
case 'ref':
head('Referal tizimi');
$all = DB::$dbs->querySingle("SELECT COUNT(`user_id`) FROM ".USERS." WHERE `ref` = ?", array($page['user_id']));
if (empty($all)) {
echo DIV_BLOCK . 'Ro`yhat bo`sh' . CLOSE_DIV;
} else {
$n = new Navigator($all,10,'');
$sql = DB::$dbs->query("SELECT `user_id`, `recording_date` FROM ".USERS." WHERE `ref` = ? ORDER BY `recording_date` DESC LIMIT {$n->start()}, 10", array($page['user_id']));
while($ank = $sql -> fetch()) {
echo DIV_BLOCK . user_choice($ank['user_id'], 'link') . ' ' . vrem($ank['recording_date']) . CLOSE_DIV;
}
echo $n->navi();
}
echo DIV_LI . '<a href="'.HOME.'/id'.$page['user_id'].'"><b>Sahifaga qaytish</b></a>' . CLOSE_DIV;
$array = array();
nav($array);
break;
case 'stat':
head('Foydalanuvchi faolligi statistikasi');
echo DIV_LI . 'Chatdagi sharhlar:</b> ' . (empty($page['chat_post']) ? 0 : $page['chat_post']) . CLOSE_DIV;
echo DIV_LI . 'Viktorinadagi javoblar:</b> ' . (empty($page['victorina']) ? 0 : $page['victorina']) . CLOSE_DIV;
$count2 = mysql_result(mysql_query("SELECT COUNT(*) FROM `duel` WHERE (`user` = '".$page['user_id']."' OR `opponent` = '".$page['user_id']."') AND `finish` != '".$page['user_id']."' AND `act` = '2'"),0);
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `duel` WHERE (`user` = '".$page['user_id']."' OR `opponent` = '".$page['user_id']."') AND `finish` = '".$page['user_id']."' AND `act` = '2'"),0);
echo DIV_LI . 'G`olib bo`lgan duellari:</b> ' . $count . ' ' . CLOSE_DIV;
echo DIV_LI . 'Yutqazgan duellari:</b> ' . $count2 . ' ' . CLOSE_DIV;
echo DIV_LI . 'Mini chatdagi sharhlar:</b> ' . (empty($page['guestbook_post']) ? 0 : $page['guestbook_post']) . CLOSE_DIV;
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUMS_POST." WHERE `user_id` = ?", array($page['user_id']));
echo DIV_LI . '<a href="'.HOME.'/posts/'.$page['user_id'].'/">Forumdagi sharhlar:</b></a> ' . $all . CLOSE_DIV;
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUMS_THEME." WHERE `user_id` = ?", array($page['user_id']));
echo DIV_LI . '<a href="'.HOME.'/themes/'.$page['user_id'].'/">Forumdagi mavzular:</b></a> ' . $all . CLOSE_DIV;
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".GROUPS_PEOPLES." WHERE `user_id` = ?", array($page['user_id']));
echo DIV_LI . 'Guruhlarga a`zo:</b> ' . $all . CLOSE_DIV;
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".BLOG." WHERE `user_id` = ?", array($page['user_id']));
echo DIV_LI . 'Kundaliklari:</b> ' . $all . CLOSE_DIV;
echo DIV_LI . 'Ro`yhatdan o`tgan:</b> ' . vrem($page['recording_date']) . CLOSE_DIV;
echo DIV_LI . '- <a href="'.HOME.'/id'.$page['user_id'].'">Sahifaga qaytish</a>' . CLOSE_DIV;
$array = array();
nav($array);
break;
case 'posts':
head('Forumdagi sharhlari');
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUM_POST." WHERE `user_id` = ?", array($page['user_id']));
if (empty($all)) {
echo DIV_BLOCK . 'Sharhlar yo`q' . CLOSE_DIV;
} else {
$n = new Navigator($all,$config['write']['forum_post'],'select=posts&id='.$page['user_id']);
$sql = DB::$dbs->query("SELECT * FROM ".FORUM_POST." WHERE `user_id` = ? ORDER BY `id` DESC LIMIT {$n->start()}, ".$config['write']['forum_post']."", array($user['user_id']));
while($post = $sql -> fetch()) {
echo DIV_BLOCK;
echo '<b>' . userLink($post['user_id']) . '</b> [' . vrem($post['time']) . ']<br />';
if (!empty($post['ct'])) {
$ct = DB::$dbs->queryFetch("SELECT `msg` FROM ".FORUMS_POST." WHERE `id` = ? ", array($post['ct']));
echo DIV_CT . '<small><b>Sitata:</b></small><br />' . text($ct['msg']) . CLOSE_DIV;
}
echo text($post['msg']);
if (!empty($post['file'])) {
$path = '../../files/forum/'.$post['file'];
$size = get_size(filesize($path));
$path_info = pathinfo($path);
echo '<br /><br />Biriktirilgan fayl: <a href="'.HOME.'/files/forum/'.$post['file'].'"><b>[Yuklash]</b></a> ['.$path_info['extension'].'] ['.$size.']<br />';
}
echo '<br /><br /><a href="'.HOME.'/forum/'.$post['forum_id'].'/'.$post['forumc_id'].'/'.$post['theme_id'].'/"><b>Mavzuga o`tish</b></a>';
echo CLOSE_DIV;
}
echo $n->navi();
}
echo DIV_LI . '<a href="'.HOME.'/id'.$page['user_id'].'"><b>Sahifaga qaytish</b></a>' . CLOSE_DIV;
$array = array();
nav($array);
break;
case 'themes':
head('Forumdagi mavzular');
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUM_THEME." WHERE `user_id` = ?", array($page['user_id']));
if ($all == 0) {
echo DIV_AUT . 'Mavzular ochilmagan' . CLOSE_DIV;
} else {
$n = new Navigator($all,$config['write']['forum_theme'],'select=themes&id='.$page['user_id']);
$sql = DB::$dbs->query("SELECT * FROM ".FORUM_THEME." WHERE `user_id` = ? ORDER BY `time` DESC LIMIT {$n->start()}, ".$config['write']['forum_theme']." ", array($page['user_id']));
while($theme = $sql -> fetch()) {
$posts = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUMS_POST." WHERE `theme_id` = ? ", array($theme['id']));
$page = ceil(($posts / $config['write']['forum_post']));
echo DIV_LI . '<a href="'.HOME.'/forum/'.$theme['forum_id'].'/'.$theme['forumc_id'].'/'.$theme['id'].'/">'.$theme['name'].'</a> ['.$posts.'] <a href="'.HOME.'/forum/'.$theme['forum_id'].'/'.$theme['forumc_id'].'/'.$theme['id'].'/?p='.$page.'">[>>]</a>' . CLOSE_DIV;
}
echo $n->navi();
}
echo DIV_LI . '<a href="'.HOME.'/id'.$page['user_id'].'"><b>Sahifaga qaytish</b></a>' . CLOSE_DIV;
$array = array();
nav($array);
break;
case 'anceta':
head('Anketa');
echo '<table cellspacing="0" cellpadding="0" width="100%" ><tr>
<td class="white" width="10%">';
echo '' . avatar($page['user_id'],48,48) . '';
echo '</td>';
echo '<td class="white" width="90%" >';
echo '' . userLink($page['user_id']) . '';
if ($page['last_time'] > (time() - 2000)) {
if ($page['is_mobile'] == 1) {
echo '<span style="float:right;">'.icon('pda.png').'</span>';
} elseif ($page['is_mobile'] == 2) {
echo '<span style="float:right;">'.icon('pc.png').'</span>';
}
} else {
echo ' ' . (empty($page['gender']) ? ' ' : ' ') . vrem($page['last_time']) . '';
}
echo ' <span style="float:right;font-size:12px;color:#66798F;">id' . $page['user_id'] . ' </span>
<span style="font-size:11px;color:#64A07A;">' . level($page['level']) . '</span><br/>';
echo '<small><b>Ro`yhatdan o`tgan:</b> ' . vrem($page['recording_date']) . '</small>';
echo '</td></tr></table>';
if ($page['user_id'] == $user['user_id']) {
echo DIV_LI . '- <a href="'.HOME.'/menu/anceta">Tahrirlash</a>' . CLOSE_DIV;
}
if (!empty($page['poznakom']) || !empty($page['goal']) || !empty($page['family_status']) || !empty($page['childtren']) || !empty($page['orientation'])) {
echo DIV_LI . '- <a href="'.HOME.'/loveanc/'.$page['user_id'].'/">Tanishuv anketasi</a>' . CLOSE_DIV;
}
echo DIV_LI . '<b>' . $page['surname'] . ' ' . $page['name'] . '</b>' . CLOSE_DIV;
echo DIV_LI . '<b>Jins:</b> ' . gender($page['gender']) . CLOSE_DIV;
echo (!empty($page['bday']) && !empty($page['bmonth']) && !empty($page['byear']) ? DIV_LI . '<b>Tug`ulgan sana:</b> ' . birthday($page['bday'],$page['bmonth'],$page['byear']) . CLOSE_DIV : NULL );
echo (!empty($page['age']) ? DIV_LI . '<b>Yosh:</b> ' . $page['age'] . CLOSE_DIV : NULL );
echo DIV_LI . '<b>Shahar:</b> ' . city($page['city']) . CLOSE_DIV;
echo (!empty($page['about']) ? DIV_LI . '<b>O`zi haqida:</b> ' . $page['about'] . CLOSE_DIV : NULL);
echo (!empty($page['interes']) ? DIV_LI . '<b>Qiziqishlari:</b> ' . $page['interes'] . CLOSE_DIV : NULL);
echo (!empty($page['music']) ? DIV_LI . '<b>Sevimli musiqasi:</b> ' . $page['music'] . CLOSE_DIV : NULL);
echo (!empty($page['cinema']) ? DIV_LI . '<b>Sevimli filmi:</b> ' . $page['cinema'] . CLOSE_DIV : NULL);
echo (!empty($page['books']) ? DIV_LI . '<b>Sevimli kitobi:</b> ' . $page['books'] . CLOSE_DIV : NULL);
echo (!empty($page['smok']) ? DIV_LI . '<b>Chekishga a`loqasi:</b> ' . smok($page['user_id']) . CLOSE_DIV : NULL);
echo (!empty($page['alco']) ? DIV_LI . '<b>Alkagolga a`loqasi:</b> ' . alco($page['user_id']) . CLOSE_DIV : NULL);
if (privilegy('anceta_update', $page['user_id'])) {
echo '<div class="white">- <a href="'.HOME.'/panel/user/edit/'.$page['user_id'].'">O`zgartirish</a><br/>';
}
echo (privilegy('anceta_delete', $page['user_id']) ? '- <a href="'.HOME.'/panel/user/delete/'.$page['user_id'].'">O`chirish</a><br/>' : NULL);
echo (privilegy('anceta_bann', $page['user_id']) ? '- <a href="'.HOME.'/panel/user/bann/'.$page['user_id'].'">BAN</a></div>' : NULL);
echo DIV_LI . '<a href="'.HOME.'/id'.$page['user_id'].'">Sahifaga qaytish</a>' . CLOSE_DIV;
$array = array();
nav($array);
break;
case 'loveanc':
head('Tanishuv anketasi');
if (empty($page['poznakom']) && empty($page['goal']) && empty($page['family_status']) && empty($page['childtren']) && empty($page['orientation'])) {
echo DIV_LI . 'Anketa to`ldirilmagan' . CLOSE_DIV;
} else {
echo (!empty($page['poznakom']) ? DIV_LI . '<b>Tanishaman:</b> ' . poznakom($page['user_id']) . CLOSE_DIV : NULL);
echo (!empty($page['goal']) ? DIV_LI . '<b>Tanishishdan maqsadi:</b> ' . goal($page['user_id']) . CLOSE_DIV : NULL);
echo (!empty($page['family_status']) ? DIV_LI . '<b>Oilaviy ahvoli:</b> ' . family_status($page['user_id']) . CLOSE_DIV : NULL);
echo (!empty($page['children']) ? DIV_LI . '<b>Bolalar bormi:</b> ' . children($page['user_id']) . CLOSE_DIV : NULL);
}
echo DIV_LI . '<a href="'.HOME.'/id'.$page['user_id'].'"><b>Sahifaga qaytish</b></a>' . CLOSE_DIV;
$array = array();
nav($array);
break;
case 'comm':
head('Guruhlar');
$all = DB::$dbs->querySingle("SELECT COUNT(`user_id`) FROM ".GROUPS_PEOPLES." WHERE `user_id` = ?", array($page['user_id']));
if ($all > 0) {
$sql = DB::$dbs->query("SELECT * FROM ".GROUPS_PEOPLES." WHERE `user_id` = ? ", array($page['user_id']));
while($post = $sql -> fetch()) {
$group = DB::$dbs->queryFetch("SELECT * FROM ".GROUPS." WHERE `id` = ? ",array($post['group_id']));
$peoples = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".GROUPS_PEOPLES." WHERE `group_id` = ? ", array($group['id']));
echo '<table cellspacing="0" cellpadding="0" width="100%" ><tr>
<td class="lines" width="5%">';
echo '' . (empty($group['logo']) ? '<img src="' . HOME . '/style/img/img.png" style="width:45px;height:45px;"/>' : '<img src="' . HOME . '/files/groups/'.$group['logo'] . '" style="width:45px;height:45px;"/>') . '';
echo '</td>';
echo '<td class="lines" width="95%" >';
echo '<a href="'.HOME.'/groups/'.$group['id'].'/"><b>' . $group['name'] . '</b></a></br> '.$peoples.' ishtrokchilar<br />';
echo '</td></tr></table>';
}
}
if ($page['user_id'] != $user['user_id']) {
if (DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".GROUPS." WHERE `user_id` = ?", array($user['user_id'])) == TRUE) {
$group = DB::$dbs->queryFetch("SELECT * FROM ".GROUPS." WHERE `user_id` = ? LIMIT 1",array($user['user_id']));
if (DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".GROUPS_PEOPLES." WHERE `group_id` = ? && `user_id` = ?", array($group['id'], $page['user_id'])) == FALSE) {
echo DIV_LI . '- <a href="'.HOME.'/soo/'.$page['user_id'].'/"><u>Guruhga taklif qilish</u></a>' . CLOSE_DIV;
}
}
}
echo DIV_LI . '- <a href="'.HOME.'/id'.$page['user_id'].'">Sahifaga qaytish</a>' . CLOSE_DIV;
$array = array();
nav($array);
break;
}
require_once('core/stop.php');
?>