Exemplo n.º 1
0
    $ObjMessages = new messages();
    // check for start and limit values for pagination
    if ($e) {
        $startval = (int) $e;
        if ($f) {
            $limitval = (int) $f;
        } else {
            $limitval = 15;
        }
    } else {
        $startval = 0;
        $limitval = 15;
    }
    if ($d) {
        $messageid = $ObjMessages->uuidToMessageID($d);
    } else {
        $messageid = "";
    }
    // get messages for this user with correct pagination
    $messages = $ObjMessages->displayMessage($ObjAkonga->usernametoid($_SESSION['username']), $messageid, $startval, $limitval);
    // Set the message to read if the message has not previously been read
    foreach ($messages as $item) {
        if ($item['message_state'] == '1') {
            $ObjMessages->markAsRead($messageid);
        }
    }
    // create the view for messages
    require_once 'web/core/messages/view.php';
} else {
    require_once 'web/core/login/index.php';
}