My personal blog. https://blog.airikr.me
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

268 lines
13 KiB

<?php
require_once 'site-settings.php';
$id_unique = null;
$reading_post = false;
if(isset($_GET['idp'])) {
$id_unique = strip_tags(htmlspecialchars($_GET['idp']));
$post_do_exists = false;
$post_exists = sql("SELECT COUNT(id_unique)
FROM posts
WHERE id_unique = :_idunique
".($session == true ? "" : "AND FROM_UNIXTIME(timestamp_published) < NOW()")."
", Array(
'_idunique' => $id_unique
), 'count');
if($post_exists != 0) {
$post_do_exists = true;
$reading_post = true;
$post = sql("SELECT *
FROM posts
WHERE id_unique = :_idunique
".($session == true ? "" : "AND FROM_UNIXTIME(timestamp_published) < NOW()")."
", Array(
'_idunique' => $id_unique
), 'fetch');
}
}
echo '<!DOCTYPE html>';
echo '<html lang="'.($viewing_in_english == false ? 'sv' : 'en').'">';
echo '<head>';
echo '<title>';
echo $og_title;
echo ($filename == 'page-read.php' ? ' _ '.($post_do_exists == false ? ($viewing_in_english == false ? 'Okänt inlägg' : 'Unknown post') : $post['subject']) : '');
echo ($filename == 'page-about.php' ? ' _ '.($viewing_in_english == false ? 'Om' : 'About') : '');
echo ($filename == 'page-privacy.php' ? ' _ '.($viewing_in_english == false ? 'Integritetspolicy' : 'Privacy policy') : '');
echo ($filename == 'page-search.php' ? ' _ '.($viewing_in_english == false ? 'Sök' : 'Search') : '');
echo ($filename == 'page-statistics.php' ? ' _ '.($viewing_in_english == false ? 'Statistik' : 'Statistics') : '');
echo ($filename == 'admin-login.php' ? ' _ '.($viewing_in_english == false ? 'Logga in' : 'Login') : '');
echo (($filename == 'admin-write.php' AND $id_unique == null) ? ' _ '.($viewing_in_english == false ? 'Skriv ett nytt inlägg' : 'Compose a new post') : '');
echo (($filename == 'admin-write.php' AND $id_unique != null) ? ' _ '.$post['subject'].' ('.($viewing_in_english == false ? 'hantera' : 'manage').')' : '');
echo '</title>';
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0">';
# echo '<meta name="robots" content="noindex">';
echo '<meta name="google" content="notranslate">';
# echo '<meta name="HandheldFriendly" content="True">';
echo '<meta name="theme-color" content="#ff0000">';
echo '<meta name="apple-mobile-web-app-capable" content="yes">';
echo '<meta name="mobile-web-app-capable" content="no">';
echo '<meta name="application-name" content="'.$og_title.'">';
echo '<meta name="apple-mobile-web-app-title" content="'.$og_title.'">';
echo '<meta name="apple-mobile-web-app-status-bar-style" content="black">';
echo '<meta property="og:title" content="'.($reading_post == false ? $og_title : $post['subject']).'">';
echo '<meta property="og:site_name" content="'.$og_title.'">';
echo '<meta property="og:type" content="'.($reading_post == false ? 'website' : 'article').'">';
echo '<meta property="og:url" content="'.$og_url . ($reading_post == false ? '' : '/read:'.$post['id_unique']).'">';
echo '<meta property="og:image" content="'.(($reading_post == true AND $post['cover_hash'] != null) ? $og_url.'/cover:'.$post['cover_hash'] : $og_image).'">';
echo '<meta property="og:image:secure_url" content="'.(($reading_post == true AND $post['cover_hash'] != null) ? $og_url.'/cover:'.$post['cover_hash'] : $og_image).'">';
echo '<meta property="og:image:type" content="image/jpeg">';
echo '<meta property="og:image:width" content="256">';
echo '<meta property="og:image:height" content="256">';
echo '<meta property="og:image:alt" content="'.(($reading_post == true AND $post['cover_hash'] != null) ? $og_url.'/cover:'.$post['cover_hash'] : $og_image).'">';
echo '<meta property="og:description" content="'.($reading_post == true ? $post['content_beforebreak'] : $og_description).'">';
echo '<meta property="og:locale" content="sv_SE">';
echo '<meta name="description" content="'.($reading_post == true ? $post['content_beforebreak'] : $og_description).'">';
echo '<meta data-rh="true" property="al:android:app_name" content="Medium">';
if($reading_post == true) {
echo '<meta property="article:published_time" content="'.date('Y-m-dTH:i:s+0100', $post['timestamp_published']).'">';
echo ($post['timestamp_edited'] == null ? '' : '<meta property="article:modified_time" content="'.date('Y-m-dTH:i:s+0100', $post['timestamp_edited']).'">');
echo '<meta name="article:author" content="'.$config_author_name.'">';
}
echo '<meta name="twitter:card" content="summary">';
echo '<meta name="twitter:title" content="'.($reading_post == false ? $og_title : $post['subject']).'">';
echo '<meta name="twitter:description" content="'.($reading_post == false ? $og_description : $post['content_beforebreak']).'">';
echo '<meta name="twitter:image" content="'.(($reading_post == true AND $post['cover_hash'] != null) ? $og_url.'/cover:'.$post['cover_hash'] : $og_image).'">';
echo '<link rel="webmention" href="https://webmention.io/'.$config_subdomain . ($config_subdomain == null ? '' : '.') . $config_domain.'/webmention">';
echo '<link rel="pingback" href="https://webmention.io/'.$config_subdomain . ($config_subdomain == null ? '' : '.') . $config_domain.'/xmlrpc">';
echo ($reading_post == false ? '' : '<link rel="pingback" href="https://webmention.io/webmention?forward='.$og_url.'/webmention">');
echo '<link rel="alternate" type="application/rss+xml" title="'.$og_title.' RSS" href="'.$og_url.'/'.($viewing_in_english == false ? '' : 'en/').'feed">';
echo '<link rel="canonical" href="'.$og_url . ($reading_post == false ? '' : '/read:'.$post['id_unique']).'">';
echo '<link href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=" rel="icon" type="image/x-icon">';
echo '<link href="https://airikr.me" rel="me">';
echo '<link href="https://github.com/e-edgren" rel="me">';
echo '<link href="https://codeberg.org/airikr" rel="me">';
echo '<link href="https://fosstodon.org/@edgren" rel="me">';
# echo '<link href="https://tools.aftertheflood.com/sparks/styles/font-faces.css" rel="stylesheet" />';
echo '<link type="text/css" rel="stylesheet preload" as="style" href="'.($config_development == true ? url('css/theme-'.$config_defaulttheme.'.css?'.time(), true) : 'https://cdn.airikr.me/blog/theme-dark.min.css').'" id="theme">';
echo '<link type="text/css" rel="stylesheet preload" as="style" href="'.($config_development == true ? url('css/desktop.css?'.time(), true) : 'https://cdn.airikr.me/blog/desktop.min.css').'">';
echo '</head>';
echo '<body>';
echo '<noscript><div>';
echo '<link type="text/css" rel="stylesheet preload" as="style" href="'.($config_development == true ? url('css/noscript.css?'.time(), true) : 'https://cdn.airikr.me/blog/noscript.min.css').'">';
echo svgicon('warning');
if($viewing_in_english == false) {
echo 'JavaScript är inaktiverat. Vissa funktioner på bloggen kommer inte att fungera.';
} else {
echo 'JavaScript are inactivated. Some features on this blog will not work.';
}
echo '</div></noscript>';
echo '<section id="website">';
echo '<div class="aside open">'.svgicon('menu-open').'</div>';
echo '<div class="aside close">'.svgicon('menu-close').'</div>';
echo '<aside>';
echo '<header class="no-select">';
echo 'Airikr';
echo '</header>';
echo '<nav id="main" class="small-text">';
echo '<a href="'.url('').'"'.((strpos($filename, 'index') !== false AND !isset($_GET['pag'])) ? ' class="active"' : '').'>';
echo svgicon('linkicon-home');
echo ($viewing_in_english == false ? 'Hem' : 'Home');
echo '</a>';
echo '<a href="'.url('search').'"'.(strpos($filename, 'search') !== false ? ' class="active"' : '').'>';
echo svgicon('linkicon-search');
echo ($viewing_in_english == false ? 'Sök' : 'Search');
echo '</a>';
echo '<a href="'.url('statistics').'"'.(strpos($filename, 'statistics') !== false ? ' class="active"' : '').'>';
echo svgicon('linkicon-statistics');
echo ($viewing_in_english == false ? 'Statistik' : 'Statistics');
echo '</a>';
if($config_allowcomments == true) {
echo '<a href="'.url('comments').'"'.(strpos($filename, 'comments') !== false ? ' class="active"' : '').'>';
echo svgicon('linkicon-comments');
echo ($viewing_in_english == false ? 'Kommentarer' : 'Comments');
echo '</a>';
}
echo '<a href="'.url('random-post'.($reading_post == true ? '/current:'.$post['id_unique'] : null)).'">';
echo svgicon('linkicon-dice');
echo ($viewing_in_english == false ? 'Slumpa inlägg' : 'Random post');
echo '</a>';
echo '<div class="space"></div>';
echo '<a href="'.url('privacy').'"'.(strpos($filename, 'privacy') !== false ? ' class="active"' : '').'>';
echo svgicon('linkicon-privacy');
echo ($viewing_in_english == false ? 'Integritetspolicy' : 'Privacy policy');
echo '</a>';
echo '<a href="'.url('copyright').'"'.(strpos($filename, 'copyright') !== false ? ' class="active"' : '').'>';
echo svgicon('linkicon-copyright');
echo ($viewing_in_english == false ? 'Uppehovsrätt' : 'Copyright');
echo '</a>';
echo '<h4>'.($viewing_in_english == false ? 'Konto' : 'Account').'</h4>';
if($session == true) {
$id_unique = (isset($_GET['idp']) ? strip_tags(htmlspecialchars($_GET['idp'])) : null);
if($user['password'] == null) {
echo '<a href="'.url('new-post').'"'.(strpos($filename, 'write') !== false ? ' class="active"' : '').'>';
echo svgicon('linkicon-admin-write');
echo ($viewing_in_english == false ? 'Författa' : 'Write');
echo '</a>';
echo '<a href="'.url('saved-posts').'"'.((strpos($filename, 'index') !== false AND isset($_GET['pag'])) ? ' class="active"' : '').'>';
echo svgicon('linkicon-admin-saved');
echo ($viewing_in_english == false ? 'Sparade' : 'Saved');
echo '</a>';
echo '<a href="'.url('files').'"'.(strpos($filename, 'files') !== false ? ' class="active"' : '').'>';
echo svgicon('linkicon-admin-files');
echo ($viewing_in_english == false ? 'Filer' : 'Files');
echo '</a>';
echo '<a href="'.url('settings').'"'.(strpos($filename, 'settings') !== false ? ' class="active"' : '').'>';
echo svgicon('linkicon-admin-settings');
echo ($viewing_in_english == false ? 'Inställningar' : 'Settings');
echo '</a>';
}
echo '<a href="'.url('logout').'" class="color-red">';
echo svgicon('linkicon-admin-logout');
echo ($viewing_in_english == false ? 'Logga ut' : 'Log out');
echo '</a>';
} else {
echo '<a href="'.url('login').'"'.(strpos($filename, 'login') !== false ? ' class="active"' : '').'>';
echo svgicon('linkicon-login');
echo ($viewing_in_english == false ? 'Logga in' : 'Login');
echo '</a>';
}
echo '<h4>'.($viewing_in_english == false ? 'Övrigt' : 'Other').'</h4>';
echo '<a href="https://codeberg.org/airikr/airikr-blog" target="_blank">';
echo svgicon('linkicon-git');
echo ($viewing_in_english == false ? 'Källkod' : 'Source code');
echo '</a>';
echo '<a href="'.url('rss-feed').'"'.(strpos($filename, 'feed') !== false ? ' class="active"' : '').'>';
echo svgicon('linkicon-rss');
echo 'RSS';
echo '</a>';
echo '<a href="javascript:void(0)" class="theme'.($config_defaulttheme == 'dark' ? ' hide' : '').'" data-theme="dark">';
echo svgicon('linkicon-theme-dark');
echo ($viewing_in_english == false ? 'Växla till mörkt tema' : 'Switch theme to dark');
echo '</a>';
echo '<a href="javascript:void(0)" class="theme'.($config_defaulttheme == 'light' ? ' hide' : '').'" data-theme="light">';
echo svgicon('linkicon-theme-light');
echo ($viewing_in_english == false ? 'Växla till ljust tema' : 'Switch theme to light');
echo '</a>';
echo '</nav>';
echo '<div class="about">';
echo '<div class="avatar"></div>';
if($viewing_in_english == false) {
echo '<p>Jag heter Erik Edgren och är '.age(1985, 7, 6).' år. Bor på Hammarö i Värmland. Har mild autism och full uppmärksamhetsstörning. '.link_('Läs mer', 'https://airikr.me').'.</p>';
echo '<p>Bloggen handlar om hur jag ser på saker och hur jag hanterar vardagen.</p>';
} else {
echo '<p>My name is Erik Edgren, and I am '.age(1985, 7, 6).' years old. I live on an island called Hammarö in Sweden and have mild autism and full attention deficit disorder. '.link_('Read more', 'https://airikr.me/en').'.</p>';
echo '<p>On this blog, you can read about my personal views of privacy and other stuff.</p>';
}
echo '</div>';
echo '</aside>';
echo '<main';
echo ($viewing_in_english == false ? '' : ' data-language="en"');
echo ' data-default-theme="'.$config_defaulttheme.'"';
echo ($theme == 'light' ? ' data-theme="light"' : '');
echo ($session == true ? ' class="logged-in"' : '');
echo ' data-localfolder="'.$config_localfolder.'"';
echo '>';
echo '<div class="dim"></div>';
?>