-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
58 lines (58 loc) · 2.41 KB
/
index.php
File metadata and controls
58 lines (58 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
include "config.php";
require_once __DIR__ . '/helpers.php';
$contents_list = pmecho_load_contents_list(__DIR__ . '/achive_list.php');
$file_num = count($contents_list);
$page_num = max(1, (int) ceil($file_num / $paging));
$site_title = $sitename . "-" . $description;
$rss_url = pmecho_build_rss_url($site_url);
$current_page_num = isset($_GET['current_page_num']) ? filter_var($_GET['current_page_num'], FILTER_VALIDATE_INT) : null;
if ($current_page_num === null || $current_page_num === false || $current_page_num < 1 || $current_page_num > $page_num) {
$current_page_num = 1;
}
$list_start = $file_num - (($current_page_num - 1) * $paging) - 1;
$list_end = max(-1, $list_start - $paging);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="description" content="<?php echo pmecho_escape($site_title); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="./typo.css"/>
<link rel="stylesheet" href="./style.css"/>
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php echo pmecho_escape($rss_url); ?>" />
<title><?php echo pmecho_escape($site_title); ?></title>
</head>
<body>
<div id="header">
<h1 id="sitename"><?php echo pmecho_escape($sitename);?></h1>
<h4 id="description"><?php echo pmecho_escape($description);?></h4>
<div id="socialapp">
<a href="/page.php?content=about-me" title="about me">About</a>
<a href="<?php echo pmecho_escape($rss_url);?>" title="RSS">RSS</a>
</div>
</div>
<div id="index_wrapper">
<div id="content_list">
<?php
for ($i = $list_start; $i > $list_end && $i >= 0; $i--) {
$article_slug = $contents_list[$i][0];
$article_date = $contents_list[$i][2];
$article_title = $contents_list[$i][1];
echo "<a class=\"title_list\" href=\"page.php?content=" . rawurlencode($article_slug) . "\"><div class=\"post_time\">[" . pmecho_escape($article_date) . "]</div><div class=\"post_title\">". pmecho_escape($article_title) ."</div></a>\n";
}
?>
</div>
<div id="pading_nav">
<?php
echo "<a href=\"index.php?current_page_num=" . $current_page_num . "\">Current page:" . pmecho_escape($current_page_num) . "</a> ";
for ($i = 1 ; $i <= $page_num; $i++) {
echo "<a href=\"index.php?current_page_num=" .$i. "\">$i</a>";
}
?>
</div>
<div id="powerby">Power by <a href="https://github.com/sluke/PMecho">PMecho</a></div>
</div>
</body>
</html>