function get_user_menu($params) { $out = ''; extract($params); $separator = empty($separator) ? '' : $separator; $prefix = empty($prefix) ? '' : $prefix; $suffix = empty($suffix) ? '' : $suffix; $pre_tag = empty($pre_tag) ? '' : $pre_tag; $after_tag = empty($after_tag) ? '' : $after_tag; if (AuthController::getInstance()->isAuthorized()) { if (Project::getInstance()->getCurUser()->access == ACCESS_LEVEL_ADMIN) { $out .= '' . $prefix . '<a href="/admin/users.php">Users</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/admin/plans.php">Plans</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/admin/statistics.php?ofc=chart-data.php">Statistics</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/admin/pages.php">Edit pages</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/admin/news.php">News</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/admin/emails.php">E-mail templates</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/admin/settings.php">Settings</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/admin/find_deposit.php">Find deposit</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/admin/messages.php">Sent messages</a>' . $suffix . ''; } $user_messages_list = new UserMessageList(Project::getInstance()->getCurUser()); $out .= '' . $prefix . '<a href="/user/account.php">' . _('Account Summary') . '</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/user/profile.php">' . _('Account Edit') . '</a>' . $suffix . '' . $separator . ' ' . ' ' . $prefix . '<a href="/user/deposit.php">' . _('Make deposit') . '</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/user/withdraw.php">' . _('Withdraw') . '</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/user/statistics.php">' . _('History') . '</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/user/messages.php">' . _('Messages') . ' (' . $user_messages_list->getCountUnread() . ')</a>' . $suffix . '' . $separator . ' ' . $prefix . '<a href="/index.php?action=logout">' . _('Logout') . '</a>' . $suffix . ''; } return $pre_tag . $out . $after_tag; }
<?php $ACCESS_LEVEL = 1; include_once DOC_ROOT . '/includes/authorization.php'; Project::getInstance()->getSmarty()->assign('user', Project::getInstance()->getCurUser()); if (isset($_REQUEST['id'])) { $message = new UserMessage(intval($_REQUEST['id'])); if ($message->id) { if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'read') { Project::getInstance()->getSmarty()->assign('from', 'Support'); Project::getInstance()->getSmarty()->assign('title', $message->title); Project::getInstance()->getSmarty()->assign('text', nl2br($message->message)); Project::getInstance()->showPage('user/message.tpl'); $message->readed = 1; $message->save(); } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') { $message->delete(); header('Location: /user/messages.php'); } } } else { $user_messages_list = new UserMessageList(Project::getInstance()->getCurUser()); Project::getInstance()->getSmarty()->assign('messages', $user_messages_list->getList()); Project::getInstance()->showPage('user/messages.tpl'); }