Файл: adultscript-2.0.3-pro/files/modules/user/components/dashboard.php
Строк: 34
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_user_dashboard extends VModule_user
{
public function __construct()
{
parent::__construct();
}
public function render()
{
VAuth::check('Registered');
$user_id = (int) $_SESSION['user_id'];
$errors = array();
$messages = array();
if (isset($_GET['requests'])) {
$action = trim($_GET['requests']);
if ($action == 'accept') {
} elseif ($action == 'deny') {
} else {
$errors[] = 'Invalid action! What exactly did you click!?';
}
}
$this->db->query("SELECT * FROM #__user_activity WHERE user_id = ".$user_id." LIMIT 1");
$this->tpl->activity = $this->db->fetch_assoc();
$this->tpl->menu = 'home';
$this->tpl->submenu = 'user-dashboard';
$this->tpl->title = __('dashboard-title');
$this->tpl->meta_title = __('dashboard-meta-title');
$this->tpl->errors = $errors;
$this->tpl->messages = $messages;
$this->tpl->requests = $this->get_friend_requests($user_id);
$this->tpl->load(array('header', 'user_dashboard', 'footer'));
$this->tpl->display();
}
private function get_friend_requests($user_id)
{
$this->db->query("SELECT uf.request_id, u.user_id, u.username, u.avatar, u.gender
FROM #__user_friends AS uf
LEFT JOIN #__user AS u ON (u.user_id = uf.friend_id)
WHERE uf.user_id = ".$user_id."
AND uf.status = 'pending'");
if ($this->db->affected_rows()) {
return $this->db->fetch_rows();
}
return NULL;
}
}