Beispiel #1
0
//filters
$mode = CValue::get("mode", "inbox");
//others
$page = CValue::get("page", 0);
$limit_list = CAppUI::pref("nbMailList", 20);
//account POP
$account_pop = new CSourcePOP();
$account_pop->load($account_id);
if ($account_pop->object_id != $user->_id && $account_pop->is_private) {
    CAppUI::stepAjax("CSourcePOP-error-private_account", UI_MSG_ERROR);
}
//no account_id, first of account of user
$where = array();
$where["object_class"] = " = 'CMediusers'";
$where["object_id"] = " = '{$user->_id}'";
$account_pop->loadObject($where);
$where = array();
//mails
$mail = new CUserMail();
switch ($mode) {
    case 'inbox':
        $nb_mails = CUserMail::countInbox($account_id);
        $mails = CUserMail::loadInbox($account_id, $page, $limit_list);
        break;
    case 'archived':
        $nb_mails = CUserMail::countArchived($account_id);
        $mails = CUserMail::loadArchived($account_id, $page, $limit_list);
        break;
    case 'favorites':
        $nb_mails = CUserMail::countFavorites($account_id);
        $mails = CUserMail::loadFavorites($account_id, $page, $limit_list);