<?php echo js_and_css(); ?> </head> <?php if (get_current_user_id()) { page_header('logged'); } else { page_header('not_logged'); } ?> <div class="video-player"> <?php echo create_youtube_iframe(get_video_id_from_youtube_link($post['link'])); ?> </div> <div class="container" style="width: 845px"> <br> <h4> Запощено <a href="<?php echo APP_URL . '/user.php?id=' . $post['user_id']; ?> "> <?php echo get_username_by_user_id($post['user_id']); ?> </a> <?php
<?php require 'init.php'; require_login(); $video_link = ''; $errors = []; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $video_link = $_POST['video_link']; if ($video_link == '') { $errors[] = "Введіть посилання на відео."; } else { if (!get_video_id_from_youtube_link($video_link)) { $errors[] = "Неможливо розпізнати посилання."; } } if (!$errors) { $post_id = create_post(get_current_user_id(), $video_link); redirect(APP_URL . '/view_post.php?id=' . $post_id); } } ?> <!DOCTYPE html> <head> <meta charset="utf-8"> <title>Tubogram</title> <?php echo js_and_css(); ?> </head>
function post_list($posts) { ?> <div class="row"> <?php foreach ($posts as $post) { ?> <div class="col-sm-4 col-md-4 col-lg-3"> <div class="thumbnail"> <a href="<?php echo APP_URL . '/view_post.php?id=' . $post['id']; ?> "> <img class="img-responsive" src="<?php echo youtube_thumb_url(get_video_id_from_youtube_link($post['link'])); ?> "> </a> <div class="caption"> <a href="<?php echo APP_URL . '/user.php?id=' . $post['user_id']; ?> "><?php echo $post['username']; ?> </a> <small class="text-muted"><?php echo format_date($post['created_at']); ?> </small> <small class="text-muted pull-right"> <span class="glyphicon glyphicon-heart"></span> <?php echo $post['like_count']; ?> <span class="glyphicon glyphicon-comment"></span> <?php echo $post['comment_count']; ?> </small> </div> </div> </div> <?php } ?> </div> <?php }