31 lines
		
	
	
		
			898 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			898 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
ini_set("display_errors", "On");
 | 
						|
error_reporting(E_ALL);
 | 
						|
include '../parts/header.php';
 | 
						|
?>
 | 
						|
    <div id="top-bar">
 | 
						|
        <h1>> Blog</h1>
 | 
						|
    </div>
 | 
						|
 | 
						|
    <article id="content">
 | 
						|
    <div class="post">Poniżej znajdziesz listę wszystkich postów na blogu ~<<USER>></div>
 | 
						|
    <?php
 | 
						|
        $posts_dir = 'posts/';
 | 
						|
        $posts = array_diff(scandir($posts_dir), array('..', '.'));
 | 
						|
        foreach ($posts as $post) {
 | 
						|
            $f = fopen("posts/$post", "r");
 | 
						|
            $line = fgets($f);
 | 
						|
            fclose($f);
 | 
						|
            $data = substr(substr($line, 4), 0, -4);
 | 
						|
            $post_data = explode(";%%%;", $data);
 | 
						|
            $title = $post_data[0];
 | 
						|
            $date = $post_data[1];
 | 
						|
 | 
						|
            echo "<div class=\"post\"><i class=\"post_date\">$date</i> - <a href=\"posts/$post\" class=\"link\">$title</a></div>";
 | 
						|
        }
 | 
						|
    ?>
 | 
						|
    </article>
 | 
						|
<?php
 | 
						|
include '../parts/footer.php';
 | 
						|
?>
 |