/** * Check a user's message quota * * This function returns true if a user doesn't exceed his messages * quotas * * @param string $login The user to check quotas for * @param boolean $check_attachment Whether to check for attachment quota as well * @return boolean True if quotas are not exceeded * @since 1.0 * @access private */ private function checkUserQuota($login, $check_attachment = true) { if ($check_attachment) { $totalSize = 0; $folders = eF_PersonalMessage::getUserFolders($login); foreach ($folders as $folder) { $totalSize += $folder['filesize']; } if ($GLOBALS['configuration']['pm_space'] != '' && $totalSize > $GLOBALS['configuration']['pm_space'] * 1024) { return false; } } return true; }
$loadScripts[] = 'scriptaculous/controls'; $loadScripts[] = 'includes/messages'; try { if (!EfrontUser::isOptionVisible('messages')) { eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure"); } formatLogin(); $result = eF_getTableData("f_personal_messages", "*", "users_LOGIN='******'login'] . "'", "priority desc, viewed,timestamp desc"); //An array of legal ids for editing entries $legalValues = array(); foreach ($result as $value) { $messages[$value['id']] = $value; $legalValues[] = $value['id']; } //---------------------------------------Start of Folders------------------------------------------- $folders = eF_PersonalMessage::getUserFolders($currentUser->user['login']); reset($folders); isset($_GET['folder']) && in_array($_GET['folder'], array_keys($folders)) && eF_checkParameter($_GET['folder'], 'id') ? $currentFolder = $_GET['folder'] : ($currentFolder = key($folders)); //key($folders) is the id of the first folder, which is always the Incoming $smarty->assign("T_FOLDER", $currentFolder); $smarty->assign("T_FOLDERS_OPTIONS", array(array('text' => _NEWFOLDER, 'image' => "16x16/folder_add.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=messages&folders=true&add=1&popup=1", 'onClick' => "eF_js_showDivPopup(event, '" . _CREATEFOLDER . "', 0)", 'target' => 'POPUP_FRAME'))); $smarty->assign("T_FOLDERS", $folders); next($folders); $smarty->assign("T_SENT_FOLDER", key($folders)); //The 'sent' folder is always the 2nd in the list foreach ($folders as $folder) { $totalMessages += $folder['messages_num']; $totalSize += $folder['filesize']; } $legalFolderValues = array_keys($folders); $smarty->assign("T_TOTAL_MESSAGES", $totalMessages);