From f7bfdf58def6aadc922e1632f407d1418269a0d7 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sat, 9 Jul 2022 19:40:17 +0300 Subject: initial --- skin/main.skin.php | 195 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 skin/main.skin.php (limited to 'skin/main.skin.php') diff --git a/skin/main.skin.php b/skin/main.skin.php new file mode 100644 index 0000000..40813b9 --- /dev/null +++ b/skin/main.skin.php @@ -0,0 +1,195 @@ +indexEmtpy() : $ctx->indexBlog($posts); +} + +function indexEmtpy($ctx): string { +return << + {$ctx->lang('blog_no')} + {$ctx->if_admin(''.$ctx->lang('write').'')} + +HTML; +} + +function indexBlog($ctx, array $posts): string { +return << +
+ all posts + {$ctx->if_admin( + ' + new + uploads + ' + )} +
+ {$ctx->indexPostsTable($posts)} + +HTML; +} + +function indexPostsTable($ctx, array $posts): string { +$ctx->year = 3000; +return << + + {$ctx->for_each($posts, fn($post) => $ctx->indexPostRow( + $post->getYear(), + $post->visible, + $post->getDate(), + $post->getUrl(), + $post->title + ))} +
+ +HTML; +} + +function indexPostRow($ctx, $year, $is_visible, $date, $url, $title): string { +return <<if_true($ctx->year > $year, $ctx->indexYearLine, $year)} + + + {$date} + + + {$title} + + +HTML; +} + +function indexYearLine($ctx, $year): string { +$ctx->year = $year; +return << + {$year} + + +HTML; +} + + +// contacts page +// ------------- + +function contacts($ctx, $email) { +return << + + + Feel free to contact me by any of the following means: + + + + Email: + + {$email} +
Please use PGP.
+ + + + Telegram: + + @eacces +
Please use Secret Chats.
+ + + + Libera.Chat: + ch1p + + +HTML; + +} + + +// any page +// -------- + +function page($ctx, $page_url, $short_name, $unsafe_html) { +return << + {$ctx->if_admin($ctx->pageAdminLinks, $page_url, $short_name)} +
{$unsafe_html}
+ +HTML; +} + +function pageAdminLinks($ctx, $url, $short_name) { +return << + {$ctx->lang('edit')} + {$ctx->lang('delete')} + +HTML; + +} + + +// post page +// --------- + +function post($ctx, $id, $title, $unsafe_html, $date, $visible, $url, $tags, $email, $urlencoded_reply_subject) { +return << +
+

{$title}

+ + +
+
{$unsafe_html}
+ +
+ {$ctx->langRaw('blog_comments_text', $email, $urlencoded_reply_subject)} +
+HTML; +} + +function postAdminLinks($ctx, $url, $id) { +return <<{$ctx->lang('edit')} +{$ctx->lang('delete')} +HTML; +} + +function postTag($ctx, $url, $name) { +return <<#{$name} +HTML; + +} + + +// tag page +// -------- + +function tag($ctx, $count, $posts, $tag) { +if (!$count) + return << + {$ctx->lang('blog_tag_not_found')} + +HTML; + +return << +
#{$tag}
+ {$ctx->indexPostsTable($posts)} + +HTML; +} \ No newline at end of file -- cgit v1.2.3