示例#1
0
    $application = Application::sharedApplication();
    $application->initializeConstellation();
    $author = new CNAuthor();
    $author->setName('GodMoose');
    $author->setAvatarUrl('http://www.gravatar.com/avatar/1a6b4b96e9933a0259babb3a9d02f759.png');
    switch ($_GET['action']) {
        case 'new':
            $message = CNMessage::messageWithContext($_POST['inputChannel']);
            $message->setTitle($_POST['inputSubject']);
            $message->setBody($_POST['inputMessage']);
            $message->setAuthor($author);
            $application->constellation->topic_new($message);
            header('Location: ' . $back);
            break;
        case 'reply':
            $message = CNMessage::messageWithContext($_GET['id']);
            $message->setTitle($_POST['inputSubject']);
            $message->setBody($_POST['inputMessage']);
            $message->setAuthor($author);
            $application->constellation->message_new($message);
            header('Location: ' . $back);
            break;
    }
}
$docRoot = getenv("DOCUMENT_ROOT");
?>
<html>
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<title>Constellation</title>
		<?php 
示例#2
0
 public function message_delete(Constellation $constellation, CNMessage $message)
 {
     $command = new CNMessageDelete();
     $options = $constellation->defaultCommandOptions();
     $options['id'] = $message->context();
     $response = $constellation->execute($command, $options);
     return $response->result;
 }