* See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once "includes/header.php";
require_once "includes/displayBuzzPost.php";
require_once '../src/buzz.php';
require_once "includes/createBuzz.php";
$buzz = createBuzz();
echo "\t<div id=\"buzzStream\">";
if (isset($_POST['buzzPostContent'])) {
    echo "<br><span style=\"margin-left:12px;font-weight:bold\">New content:</span><br>";
    $object = new buzzObject($_POST['buzzPostContent']);
    $post = buzzPost::createPost($object);
    $post->id = $_POST['postId'];
    $newPost = $buzz->updatePost($post);
    displayBuzzPost($buzz, $newPost);
} elseif (isset($_GET['postId'])) {
    $post = $buzz->getPost($_GET['postId']);
    echo "<div class=\"buzzPost ui-corner-all\">\n    \t\t<form method=\"post\">\n    \t\t\t<b>Enter post text:</b><br>\n    \t\t\t<textarea name=\"buzzPostContent\" class=\"ui-corner-all\">{$post->object->originalContent}</textarea><br>\n    \t\t\t<input type=\"hidden\" name=\"postId\" value=\"" . htmlentities($_GET['postId']) . "\">\n    \t\t\t<input type=\"submit\" value=\"Edit post\">\n    \t\t</form>\n\t\t</div>";
} else {
    $stream = $buzz->getPosts('@self', '@me');
    // If we got here, the read action succeeded and we can display the posts
    if (count($stream->posts)) {
        foreach ($stream->posts as $post) {
            echo "<div class=\"buzzPost ui-corner-all\">\n        <a class=\"person\" href=\"editPost.php?postId=" . urlencode($post->id) . "\">edit</a>\n        post with ID <span style=\"font-weight: bold\">{$post->id}</span>\n        <span style=\"font-style: italic\">{$post->title}..</span>\n        </div>";
        }
    } else {
        echo "<h2>No posts returned, try following some people?</examples/includes/footer.php";
    }
}
echo "\t</div>\n";
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once "includes/header.php";
require_once "includes/displayBuzzPost.php";
require_once '../src/buzz.php';
require_once "includes/createBuzz.php";
$buzz = createBuzz();
// And fetch the @consumption posts
$stream = $buzz->getPosts('@consumption', '@me', 16, 16, 24);
// If we got here, the read action succeeded and we can display the posts
if (count($stream->posts)) {
    echo "\t<div id=\"buzzStream\">";
    foreach ($stream->posts as $post) {
        displayBuzzPost($buzz, $post);
    }
    echo "\t</div>\n";
} else {
    echo "<h2>No posts returned, try following some people?</examples/includes/footer.php";
}
include "includes/footer.php";