Example #1
0
    } else {
        save_post(0);
    }
} else {
    if (!empty($_REQUEST['id'])) {
        if ($message = PrivateMessage::from_db(intval($_REQUEST['id']))) {
            $message->print_edit_form();
        }
    } else {
        // A new post
        $message = new PrivateMessage();
        if (!empty($_REQUEST['user_id'])) {
            $message->to = intval($_REQUEST['user_id']);
        }
        $message->author = $current_user->user_id;
        $message->print_edit_form();
    }
}
function save_post($message_id)
{
    global $link, $db, $message, $current_user, $globals, $site_key;
    $message = new PrivateMessage();
    $to_user = User::get_valid_username($_POST['to_user']);
    if (!$to_user) {
        echo 'ERROR: ' . _('nombre de usuario errĂ³neo');
        die;
    }
    $to = User::get_user_id($to_user);
    if (!$to > 0) {
        echo 'ERROR: ' . _('usuario errĂ³neo');
        die;