コード例 #1
0
ファイル: xmlvisitor.php プロジェクト: laiello/abbov
 function visitPost(Post $p)
 {
     $text = $p->getText();
     $title = $p->getTitle();
     $author = $p->getAuthor();
     $time = $p->getTime();
     $tags = $this->tagsToString($p->getTags());
     echo '<post>';
     echo '<title>' . utf8_encode($title) . '</title>';
     echo '<author>' . utf8_encode($author) . '</author>';
     echo '<time>' . utf8_encode(date("H:i:s - d/m/Y", $time)) . '</time>';
     echo '<tags>' . utf8_encode($tags) . '</tags>';
     echo '<text>' . utf8_encode($text) . '</text>';
     echo '</post>';
 }
コード例 #2
0
ファイル: rssvisitor.php プロジェクト: laiello/abbov
 function visitPost(Post $p)
 {
     $text = $p->getText();
     $title = $p->getTitle();
     $author = $p->getAuthor();
     $time = $p->getTime();
     $id = $p->getID();
     echo '<item>';
     echo '<guid isPermaLink="false">' . utf8_encode("ABBOV_ID_" . $id) . '</guid>';
     echo '<title>' . utf8_encode($title) . '</title>';
     echo '<description>' . utf8_encode($text) . '</description>';
     echo '<pubDate>' . date("D, d M Y G:i:s O", $time) . '</pubDate>';
     echo '<dc:creator>' . $author . '</dc:creator>';
     echo '</item>';
 }
コード例 #3
0
ファイル: pagevisitor.php プロジェクト: laiello/abbov
 function visitPost(Post $p)
 {
     $text = $p->getText();
     $title = $p->getTitle();
     $author = $p->getAuthor();
     $time = $p->getTime();
     $tags = $this->tagsToString($p->getTags());
     echo '<div id="post">';
     echo '<b>' . $title . "</b><br>";
     echo $author . ' @ ' . date("H:i:s - d/m/Y", $time) . '<br>';
     echo 'Tags: ' . $tags . '<br><br>';
     echo $text;
     echo "<br><br>";
     echo '</div>';
 }
コード例 #4
0
ファイル: htmlvisitor.php プロジェクト: laiello/abbov
 function visitPost(Post $p)
 {
     $text = $p->getText();
     $title = $p->getTitle();
     $author = $p->getAuthor();
     $time = $p->getTime();
     $tags = $this->tagsToString($p->getTags());
     $id = $p->getID();
     echo '<div class="post">';
     echo '<b>' . $title . "</b><br>";
     echo $author . ' @ ' . date("H:i:s - d/m/Y", $time) . '<br>';
     echo 'Tags: ' . $tags . '<br><br>';
     echo $text;
     echo "<br><br>";
     echo '<a href="deletepost.php?id=' . $id . '">Delete post</a>';
     echo "<br><br>";
     echo '</div>';
 }
コード例 #5
0
 public function save(Post $post)
 {
     $id = $this->persistence->persist(['text' => $post->getText(), 'title' => $post->getTitle()]);
     $post->setId($id);
 }
コード例 #6
0
?>
				</select></div><div class="col-md-2">
				<input class="form-control" type="hidden" name="action" id="action" value="add_get"><input type="submit" class="btn btn-warning" value="Select Post"></div>
				</form>
				<br><br><br>
				<form action="../controller/post_controller.php" method="POST">
					<textarea class="form-control" type="text" name="title" id="title" ><?php 
echo $postOnGet->getTitle();
?>
 </textarea><br>
					<textarea class="form-control" type="text" name="subtitle" id="subtitle" ><?php 
echo $postOnGet->getSubTitle();
?>
</textarea><br>
					<textarea class="form-control" type="text" name="text" id="text"><?php 
echo $postOnGet->getText();
?>
</textarea><br>
					<input class="form-control" type="date" name="date" id="date" <?php 
echo 'value=' . $postOnGet->getDate();
?>
 ><br>
					<select class="form-control editAvatar" name="image" id="avatar">
						<option value="null">Select image...</option>
						
						<?php 
$optionList = getAllImagesWithSelect($postOnGet->getImage());
echo $optionList;
?>

					</select>
コード例 #7
0
 /**
  * Save post object and populate it with id
  *
  * @param Post $post
  * @return Post
  */
 public function save(Post $post)
 {
     $id = $this->persistence->persist(array('author' => $post->getAuthor(), 'created' => $post->getCreated(), 'text' => $post->getText(), 'title' => $post->getTitle()));
     $post->setId($id);
     return $post;
 }
コード例 #8
0
ファイル: index.php プロジェクト: sheyooo/testify
    }
    if ($id) {
        $p = new Post($id);
        $app->response->status(201);
        if ($u = $p->getAuthor()) {
            $user = ["user_id" => $u->getID(), "avatar" => $u->getProfilePictureURL(), "name" => $u->getFullname()];
        } else {
            $user = ["user_id" => null, "avatar" => "img/favicon.png", "name" => "Anonymous"];
        }
        $ijson = [];
        if ($imgs = $p->getImages()) {
            foreach ($imgs as $i) {
                $ijson[] = ["url" => $i->getUrl(), "alt" => $i->getFileName()];
            }
        }
        $j = ["post_id" => $p->getID(), "liked" => false, "tapped_into" => false, "likes_count" => 0, "comments_count" => 0, "taps_count" => 0, "text" => $p->getText(), "time" => $p->getTime(), "category" => $p->getCategory()->getName(), "user" => $user, "images" => $ijson, "comments" => []];
        echo json_encode($j);
    } else {
        echo json_encode(["status" => false]);
    }
});
$app->get('/posts', function () use($app) {
    $posts = App::getPosts(["limit" => 25, "user_id" => 13]);
    echo json_encode(Utility::formatActivitiesToPosts($posts, $app));
});
$app->delete('/posts/:id', function ($id) use($app) {
    $p = new Post($id);
    if ($p->getID() && $app->environment()['testify.user_id'] == $p->getAuthor()->getID()) {
        $p->delete();
        if ($p) {
            echo json_encode(['status' => true]);
コード例 #9
0
ファイル: database.php プロジェクト: laiello/abbov
 function addPost(Post $p)
 {
     $query = "INSERT INTO `" . $this->_database . "`.`Posts` ";
     $query .= "(`ID`, `Title`, `Text`, `Author`, `Time`, `Tags`) ";
     $query .= "VALUES (NULL, '" . $p->getTitle() . "', ";
     $query .= "'" . $p->getText() . "', ";
     $query .= "'" . $p->getAuthor() . "', ";
     $query .= "'" . $p->getTime() . "', ";
     $query .= "'" . serialize($p->getTags()) . "');";
     $added = mysql_query($query, $this->_connection);
 }
コード例 #10
0
ファイル: PostManager.php プロジェクト: harraps/miniForum
 public function update(Post $post)
 {
     $this->updateObject('Post', 'p_id', $post->getId(), ['p_text' => $post->getText()]);
 }