public function execute() { $tp = SJB_System::getTemplateProcessor(); $user = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_sid', 0, SJB_Request::METHOD_GET)); $user_id = $user['sid']; if (SJB_Request::getVar('pm_action', '', SJB_Request::METHOD_POST) == 'delete') { $checked = SJB_Request::getVar('pm_check', array(), SJB_Request::METHOD_POST); SJB_PrivateMessage::delete($checked); } $page = intval(SJB_Request::getVar('page', 1, SJB_Request::METHOD_GET)); $per_page = 10; $total = SJB_PrivateMessage::getTotalInbox($user_id); $max_pages = ceil($total / $per_page); if ($max_pages == 0) { $max_pages = 1; } if ($max_pages < $page) { SJB_HelperFunctions::redirect("?user_sid={$user_id}&page={$max_pages}"); } $navigate = SJB_PrivateMessage::getNavigate($page, $total, $per_page); $list = SJB_PrivateMessage::getListInbox($user_id, $page, $per_page); $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user['user_group_sid']); SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']); $tp->assign("user_group_info", $userGroupInfo); $tp->assign('username', $user['username']); $tp->assign('user_sid', $user_id); $tp->assign('message', $list); $tp->assign('navigate', $navigate); $tp->assign('page', $page); $tp->display('pm_inbox.tpl'); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $user = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_sid')); $user_id = $user['sid']; $total_in = SJB_PrivateMessage::getTotalInbox($user_id); $total_out = SJB_PrivateMessage::getTotalOutbox($user_id); $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user['user_group_sid']); SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']); $tp->assign('username', $user['username']); $tp->assign("user_group_info", $userGroupInfo); $tp->assign('user_sid', $user_id); $tp->assign('total_in', $total_in); $tp->assign('total_out', $total_out); $tp->display('main.tpl'); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); if (SJB_UserManager::isUserLoggedIn()) { $user_id = SJB_UserManager::getCurrentUserSID(); $action = SJB_Request::getVar('pm_action', SJB_Request::METHOD_POST, false); if ($action) { $checked = SJB_Request::getVar('pm_check', SJB_Request::METHOD_POST, array()); switch ($action) { case 'mark': SJB_PrivateMessage::markAsRead($checked); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/private-messages/inbox/'); break; case 'delete': SJB_PrivateMessage::delete($checked); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/private-messages/inbox/'); break; default: break; } } $page = SJB_Request::getInt('page', 1, 'GET'); $messagesPerPage = SJB_Request::getInt('messagesPerPage', 10); $total = SJB_PrivateMessage::getTotalInbox($user_id); $totalPages = ceil($total / $messagesPerPage); if ($totalPages == 0) { $totalPages = 1; } if (empty($page) || $page <= 0) { $page = 1; } if ($totalPages < $page) { SJB_HelperFunctions::redirect("?page={$totalPages}"); } $tp->assign('message_list', SJB_PrivateMessage::getListInbox($user_id, $page, $messagesPerPage)); $tp->assign('include', 'list_inbox.tpl'); $tp->assign('messagesPerPage', $messagesPerPage); $tp->assign('page', $page); $tp->assign('totalPages', $totalPages); $tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id)); } $tp->display('main.tpl'); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $action = SJB_Request::getVar('action', '', SJB_Request::METHOD_GET); $mess_id = intval(SJB_Request::getVar('mess', 0, SJB_Request::METHOD_GET)); $return_to = SJB_Request::getVar('from', 'in', SJB_Request::METHOD_GET); $page = intval(SJB_Request::getVar('page', 1, SJB_Request::METHOD_GET)); $user = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_sid')); $user_id = $user['sid']; if ($action == 'delete') { SJB_DB::query("DELETE FROM `private_message` WHERE `id` = '{$mess_id}'"); $per_page = 10; if ($return_to == 'in') { $total = SJB_PrivateMessage::getTotalInbox($user_id); } else { $total = SJB_PrivateMessage::getTotalOutbox($user_id); } $max_pages = ceil($total / $per_page); if ($max_pages == 0) { $max_pages = 1; } if ($max_pages < $page) { $page = $max_pages; } $site_url = SJB_System::getSystemSettings('SITE_URL'); SJB_HelperFunctions::redirect($site_url . '/private-messages/pm-' . ($return_to == 'in' ? 'inbox' : 'outbox') . "/?user_sid={$user_id}&page={$page}"); } $message = SJB_PrivateMessage::ReadMessage($mess_id, true); $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user['user_group_sid']); SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']); $tp->assign("user_group_info", $userGroupInfo); $tp->assign('returt_to', $return_to); $tp->assign('username', $user['username']); $tp->assign('user_sid', $user_id); $tp->assign('message', $message); $tp->assign('page', $page); $tp->display('pm_read.tpl'); }