Exemplo n.º 1
0
<?php

$root = './../..';
require $root . '/../app/initialize.php';
$user = User::get();
if (isset($_POST['send'])) {
    $toID = 1;
    $msg = trim($db->real_escape_string($_POST['message']));
    if (is_int($toID) && validString($msg)) {
        // Check if toID exists
        if (User::IDExists($toID)) {
            $mail = UserMail::write($toID, $msg);
            if ($mail && $mail->save()) {
                $session->message("Message sent!");
                redirect('compose.php');
            } else {
                $error = "Failed to send message.";
            }
        } else {
            $error = "Message not sent because user does not exists.";
        }
    } else {
        $error = "Please fill out all fields.";
    }
}
?>

<?php 
includeFile('site/header.php');
?>
Exemplo n.º 2
0
<?php

$root = './../..';
require $root . '/../app/initialize.php';
$user = User::get();
$msgs = UserMail::getInbox($user->id);
?>

<?php 
includeFile('site/header.php');
?>

	<h2>Mail</h2>
	<h3>Inbox</h3>

<?php 
getAlerts();
?>

<?php 
if (count($msgs)) {
    ?>
	<table class="table table-hover">
		<tbody>
		<?php 
    foreach ($msgs as $msg) {
        $fromUser = User::findByID($msg->id);
        ?>
			<tr>
				<td><?php 
        echo $fromUser->fullName();